Search in sources :

Example 1 with TestSuiteProperties

use of org.sakuli.datamodel.properties.TestSuiteProperties in project sakuli by ConSol.

the class CommonInitializingServiceImplTest method testInitWithOutTestCases.

@Test
public void testInitWithOutTestCases() throws Throwable {
    TestSuiteProperties props = new TestSuiteProperties();
    props.setTestSuiteId("suite_id");
    props.setLoadTestCasesAutomatic(false);
    testSuiteProperties = spy(props);
    ts = spy(new TestSuite(testSuiteProperties));
    MockitoAnnotations.initMocks(this);
    testling.initTestSuite();
    assertEquals(ts.getState(), TestSuiteState.RUNNING);
    assertNotNull(ts.getStartDate());
    assertNull(ts.getAbsolutePathOfTestSuiteFile());
    assertEquals(ts.getDbPrimaryKey(), -1);
    assertNull(ts.getTestCases());
    assertEquals(ts.getId(), "suite_id");
}
Also used : TestSuite(org.sakuli.datamodel.TestSuite) TestSuiteProperties(org.sakuli.datamodel.properties.TestSuiteProperties) Test(org.testng.annotations.Test)

Example 2 with TestSuiteProperties

use of org.sakuli.datamodel.properties.TestSuiteProperties in project sakuli by ConSol.

the class TestSuiteHelperTest method testInitExceptionForTestCase.

@Test(expectedExceptions = FileNotFoundException.class, expectedExceptionsMessageRegExp = "test case path \".*unValidTestCase.*\" doesn't exists - check your \"testsuite.suite\" file")
public void testInitExceptionForTestCase() throws Throwable {
    TestSuiteProperties testProps = TestSuitePropertiesTestUtils.getTestProps(this.getClass(), "unvalid", "unvalid_id");
    TestSuiteHelper.loadTestCases(testProps);
}
Also used : TestSuiteProperties(org.sakuli.datamodel.properties.TestSuiteProperties) Test(org.testng.annotations.Test)

Example 3 with TestSuiteProperties

use of org.sakuli.datamodel.properties.TestSuiteProperties in project sakuli by ConSol.

the class TestSuiteHelperTest method testInit.

@Test
public void testInit() throws Throwable {
    TestSuiteProperties testProps = TestSuitePropertiesTestUtils.getTestProps(this.getClass(), "valid", "suite_id_001");
    HashMap<String, TestCase> result = TestSuiteHelper.loadTestCases(testProps);
    assertEquals(1, result.size());
    //tests if onyl the valid testcase are in the suite, with there right names
    TestCase tc = result.values().iterator().next();
    assertEquals("http://localhost:8080", tc.getStartUrl());
    assertEquals(tc.getName(), "validTestCase");
    assertEquals(tc.getId(), "validTestCase");
    assertEquals(tc.getId(), result.keySet().iterator().next());
}
Also used : TestCase(org.sakuli.datamodel.TestCase) TestSuiteProperties(org.sakuli.datamodel.properties.TestSuiteProperties) Test(org.testng.annotations.Test)

Example 4 with TestSuiteProperties

use of org.sakuli.datamodel.properties.TestSuiteProperties in project sakuli by ConSol.

the class TestSuitePropertiesTestUtils method getTestProps.

public static TestSuiteProperties getTestProps(Class<?> classDef, String resourcePath, String suiteId) throws URISyntaxException {
    Path folderPath = Paths.get(classDef.getResource(resourcePath).toURI());
    assertTrue(Files.exists(folderPath));
    assertTrue(Files.isDirectory(folderPath));
    TestSuiteProperties props = new TestSuiteProperties();
    props.setTestSuiteFolder(folderPath);
    props.setTestSuiteSuiteFile(Paths.get(folderPath.toString() + TestSuiteProperties.TEST_SUITE_SUITE_FILE_APPENDER));
    props.setTestSuiteId(suiteId);
    props.setLoadTestCasesAutomatic(true);
    return props;
}
Also used : Path(java.nio.file.Path) TestSuiteProperties(org.sakuli.datamodel.properties.TestSuiteProperties)

Aggregations

TestSuiteProperties (org.sakuli.datamodel.properties.TestSuiteProperties)4 Test (org.testng.annotations.Test)3 Path (java.nio.file.Path)1 TestCase (org.sakuli.datamodel.TestCase)1 TestSuite (org.sakuli.datamodel.TestSuite)1