use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class SakuliExceptionHandlerTest method testSaveExceptionsInStep.
@Test
public void testSaveExceptionsInStep() throws Exception {
TestSuite ts = new TestSuite();
when(loader.getTestSuite()).thenReturn(ts);
TestCase tc = new TestCase(null, null);
when(loader.getCurrentTestCase()).thenReturn(tc);
TestCaseStep step = new TestCaseStep();
when(loader.getCurrentTestCaseStep()).thenReturn(step);
testling.saveException(new SakuliException("test"));
assertNull(ts.getException());
assertNull(tc.getException());
assertEquals(step.getException().getMessage(), "test");
}
use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class SakuliExceptionHandlerTest method testGetAllExceptions.
@Test
public void testGetAllExceptions() throws Exception {
TestSuite ts = new TestSuite();
ts.addException(new SakuliException("bla"));
TestCase tc = new TestCase(null, null);
tc.addException(new SakuliException("bla2"));
ts.addTestCase(tc);
TestCaseStep step = new TestCaseStep();
step.addException(new SakuliException("bla3"));
tc.addStep(step);
List<Throwable> allExceptions = SakuliExceptionHandler.getAllExceptions(ts);
assertEquals(allExceptions.size(), 3);
}
use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class SakuliExceptionHandlerTest method testContainsExceptionsCase.
@Test
public void testContainsExceptionsCase() throws Exception {
TestSuite ts = new TestSuite();
TestCase tc = new TestCase(null, null);
tc.addException(new SakuliException("bla2"));
ts.addTestCase(tc);
TestCaseStep step = new TestCaseStep();
tc.addStep(step);
assertTrue(SakuliExceptionHandler.containsException(ts));
}
use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class SakuliExceptionHandlerTest method setUp.
private void setUp() throws Exception {
expectedScreenshotPath = Paths.get(screenShotFolder + "test.jpg");
when(screenshotActionsMock.takeScreenshot(anyString(), any(Path.class))).thenReturn(expectedScreenshotPath);
when(loader.getScreenshotActions()).thenReturn(screenshotActionsMock);
testCase = new TestCase("testling", "1234_");
HashMap<String, TestCase> testCases = new HashMap<>();
testCases.put(testCase.getId(), testCase);
testSuite = new TestSuite();
testSuite.setState(TestSuiteState.RUNNING);
ReflectionTestUtils.setField(testSuite, "testCases", testCases);
when(loader.getActionProperties()).thenReturn(actionProperties);
when(actionProperties.isTakeScreenshots()).thenReturn(true);
when(loader.getSakuliProperties()).thenReturn(sakuliProperties);
when(sakuliProperties.isSuppressResumedExceptions()).thenReturn(false);
when(loader.getSahiReport()).thenReturn(sahiReport);
when(loader.getTestSuite()).thenReturn(testSuite);
when(loader.getCurrentTestCase()).thenReturn(testCase);
}
use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class AbstractOutputBuilderTest method testFormatTestSuiteStateMessageUnknown.
@Test
public void testFormatTestSuiteStateMessageUnknown() throws Exception {
TestSuite testSuiteExample = new TestSuiteExampleBuilder().withId("sakuli-123").withState(TestSuiteState.RUNNING).withStopDate(null).buildExample();
String result = testling.formatTestSuiteSummaryStateMessage(testSuiteExample, properties.getTemplateSuiteSummary());
assertEquals(result, "[UNKN] Sakuli suite \"sakuli-123\" suite still running. (Last suite run: xx)");
}
Aggregations