use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class Icinga2OutputBuilderTest method testBuildWarningInStep.
@Test
public void testBuildWarningInStep() throws Exception {
TestSuite testSuite = new TestSuiteExampleBuilder().withState(TestSuiteState.WARNING_IN_STEP).withId("TEST-SUITE-ID").withTestCases(Collections.singletonList(new TestCaseExampleBuilder().withId("TEST-CASE-ID").withStopDate(DateUtils.addSeconds(new Date(), 4)).withState(TestCaseState.WARNING_IN_STEP).withWarningTime(5).withTestCaseSteps(Collections.singletonList(new TestCaseStepExampleBuilder().withName("TEST-STEP-ID").withWarningTime(2).withState(TestCaseStepState.WARNING).buildExample())).buildExample())).buildExample();
ReflectionTestUtils.setField(testling, "testSuite", testSuite);
Assert.assertEquals(testling.build(), "[WARN] Sakuli suite \"TEST-SUITE-ID\" warning in step, step \"TEST-STEP-ID\" over runtime (3.00s/warn at 2s). (Last suite run: 17.08.14 14:02:00)\n" + "[WARN] case \"TEST-CASE-ID\" (4.00s) ok, step \"TEST-STEP-ID\" over runtime (3.00s/warn at 2s)");
}
use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class Icinga2OutputBuilderTest method testBuildErrorInSuite.
@Test
public void testBuildErrorInSuite() throws Exception {
TestSuite testSuite = new TestSuiteExampleBuilder().withState(TestSuiteState.ERRORS).withId("TEST-SUITE-ID").withTestCases(Collections.singletonList(new TestCaseExampleBuilder().withId("TEST-CASE-ID").withState(TestCaseState.OK).buildExample())).withException(new SakuliException("MY-TEST-ERROR-SUITE")).buildExample();
ReflectionTestUtils.setField(testling, "testSuite", testSuite);
Assert.assertEquals(testling.build(), "[CRIT] Sakuli suite \"TEST-SUITE-ID\" (120.00s) EXCEPTION: 'MY-TEST-ERROR-SUITE'. (Last suite run: 17.08.14 14:02:00)\n" + "[OK] case \"TEST-CASE-ID\" ran in 3.00s - ok");
}
use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class Icinga2OutputBuilderTest method testBuildErrorInCaseMaxLength.
@Test
public void testBuildErrorInCaseMaxLength() throws Exception {
TestSuite testSuite = new TestSuiteExampleBuilder().withState(TestSuiteState.ERRORS).withId("TEST-SUITE-ID").withTestCases(Collections.singletonList(new TestCaseExampleBuilder().withId("TEST-CASE-ID").withState(TestCaseState.ERRORS).withException(new SakuliException("MY-TEST-ERROR-CASE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")).buildExample())).buildExample();
ReflectionTestUtils.setField(testling, "testSuite", testSuite);
Assert.assertEquals(testling.build(), "[CRIT] Sakuli suite \"TEST-SUITE-ID\" (120.00s) EXCEPTION: 'CASE \"TEST-CASE-ID\": MY-TEST-ERROR-CASE " + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...\n" + "[CRIT] case \"TEST-CASE-ID\" EXCEPTION: MY-TEST-ERROR-CASE " + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
}
use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class Icinga2OutputBuilderTest method testBuildCriticalInCase.
@Test
public void testBuildCriticalInCase() throws Exception {
TestSuite testSuite = new TestSuiteExampleBuilder().withState(TestSuiteState.CRITICAL_IN_CASE).withCriticalTime(140).withId("TEST-SUITE-ID").withTestCases(Collections.singletonList(new TestCaseExampleBuilder().withId("TEST-CASE-ID").withState(TestCaseState.CRITICAL).buildExample())).buildExample();
ReflectionTestUtils.setField(testling, "testSuite", testSuite);
Assert.assertEquals(testling.build(), "[CRIT] Sakuli suite \"TEST-SUITE-ID\" critical in case, case \"Unit Test Case\" over runtime (3.00s/crit at 5s). (Last suite run: 17.08.14 14:02:00)\n" + "[CRIT] case \"TEST-CASE-ID\" over runtime (3.00s/crit at 5s)");
}
use of org.sakuli.datamodel.TestSuite in project sakuli by ConSol.
the class TestSuiteBuilder method createEmptyTestSuite.
public static TestSuite createEmptyTestSuite() {
TestSuite newTestSuite = new TestSuite();
newTestSuite.setName("Integration Test Sample Test Suite");
newTestSuite.setId("IntegrationTest_" + System.nanoTime());
newTestSuite.setStartDate(new Date());
newTestSuite.setWarningTime(0);
newTestSuite.setCriticalTime(0);
newTestSuite.setState(TestSuiteState.RUNNING);
newTestSuite.setBrowserInfo("Firefox Test Browser");
TestCase testCase = TestCaseBuilder.createEmptyTestCase();
newTestSuite.addTestCase(testCase.getId(), testCase);
return newTestSuite;
}
Aggregations