use of org.sakuli.datamodel.state.TestCaseStepState in project sakuli by ConSol.
the class CommonResultServiceImplTest method testSaveAllResults.
@Test(dataProvider = "states")
public void testSaveAllResults(TestSuiteState testSuiteState, TestCaseState testCaseState, String stateOutputRegex) throws Exception {
TestCaseStepState stepState = TestCaseStepState.WARNING;
TestSuite testSuite = new TestSuiteExampleBuilder().withId("LOG_TEST_SUITE").withState(testSuiteState).withException(testSuiteState.isError() ? new SakuliException("TEST") : null).withTestCases(Collections.singletonList(new TestCaseExampleBuilder().withTestCaseSteps(Collections.singletonList(new TestCaseStepExampleBuilder().withState(stepState).buildExample())).withState(testCaseState).buildExample())).buildExample();
ReflectionTestUtils.setField(testling, "testSuite", testSuite);
Path logfile = Paths.get(properties.getLogFile());
testling.saveAllResults();
String lastLineOfLogFile = getLastLineOfLogFile(logfile, testSuiteState.isError() ? 42 : 39);
List<String> regExes = getValidationExpressions(testSuiteState, testCaseState, stepState, stateOutputRegex, "TEST");
List<String> strings = Arrays.asList(lastLineOfLogFile.split("\n"));
Iterator<String> regExIterator = regExes.iterator();
verifyOutputLines(strings, regExIterator);
}
Aggregations