use of org.sakuli.builder.TestSuiteExampleBuilder in project sakuli by ConSol.
the class Icinga2OutputBuilderTest method testBuildErrorInStep.
@Test
public void testBuildErrorInStep() 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).withTestCaseSteps(Collections.singletonList(new TestCaseStepExampleBuilder().withState(TestCaseStepState.ERRORS).withException(new SakuliCheckedException("MY-TEST-ERROR-IN-STEP")).buildExample())).buildExample())).buildExample();
ReflectionTestUtils.setField(testling, "testSuite", testSuite);
Assert.assertEquals(testling.build(), "[CRIT] Sakuli suite \"TEST-SUITE-ID\" (120.00s) EXCEPTION: 'CASE \"TEST-CASE-ID\": STEP \"step_for_unit_test\": MY-TEST-ERROR-IN-STEP'. (Last suite run: 17.08.14 14:02:00)\n" + "[CRIT] case \"TEST-CASE-ID\" EXCEPTION: STEP \"step_for_unit_test\": MY-TEST-ERROR-IN-STEP");
}
use of org.sakuli.builder.TestSuiteExampleBuilder in project sakuli by ConSol.
the class Icinga2OutputBuilderTest method testBuildOk.
@Test
public void testBuildOk() throws Exception {
TestSuite testSuite = new TestSuiteExampleBuilder().withState(TestSuiteState.OK).withId("TEST-SUITE-ID").withTestCases(Collections.singletonList(new TestCaseExampleBuilder().withId("TEST-CASE-ID").buildExample())).buildExample();
ReflectionTestUtils.setField(testling, "testSuite", testSuite);
Assert.assertEquals(testling.build(), "[OK] Sakuli suite \"TEST-SUITE-ID\" ok (120.00s). (Last suite run: 17.08.14 14:02:00)\n" + "[OK] case \"TEST-CASE-ID\" ran in 3.00s - ok");
}
use of org.sakuli.builder.TestSuiteExampleBuilder in project sakuli by ConSol.
the class Icinga2OutputBuilderTest method testBuildWarningInSuite.
@Test
public void testBuildWarningInSuite() throws Exception {
TestSuite testSuite = new TestSuiteExampleBuilder().withState(TestSuiteState.WARNING_IN_SUITE).withId("TEST-SUITE-ID").withWarningTime(100).withTestCases(Collections.singletonList(new TestCaseExampleBuilder().withId("TEST-CASE-ID").withState(TestCaseState.OK).buildExample())).buildExample();
ReflectionTestUtils.setField(testling, "testSuite", testSuite);
Assert.assertEquals(testling.build(), "[WARN] Sakuli suite \"TEST-SUITE-ID\" warning (120.00s/warn at 100s). (Last suite run: 17.08.14 14:02:00)\n" + "[OK] case \"TEST-CASE-ID\" ran in 3.00s - ok");
}
use of org.sakuli.builder.TestSuiteExampleBuilder in project sakuli by ConSol.
the class Icinga2OutputBuilderTest method testBuildCritical.
@Test
public void testBuildCritical() throws Exception {
TestSuite testSuite = new TestSuiteExampleBuilder().withState(TestSuiteState.CRITICAL_IN_SUITE).withCriticalTime(100).withId("TEST-SUITE-ID").withTestCases(Collections.singletonList(new TestCaseExampleBuilder().withId("TEST-CASE-ID").withState(TestCaseState.OK).buildExample())).buildExample();
ReflectionTestUtils.setField(testling, "testSuite", testSuite);
Assert.assertEquals(testling.build(), "[CRIT] Sakuli suite \"TEST-SUITE-ID\" critical (120.00s/crit at 100s). (Last suite run: 17.08.14 14:02:00)\n" + "[OK] case \"TEST-CASE-ID\" ran in 3.00s - ok");
}
Aggregations