use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class DynamicNodeGenerationTests method singleDynamicTestInNestedDynamicContainerIsExecutedWhenDiscoveredByUniqueId.
@Test
void singleDynamicTestInNestedDynamicContainerIsExecutedWhenDiscoveredByUniqueId() {
UniqueId uniqueId = //
discoverUniqueId(MyDynamicTestCase.class, "twoNestedContainersWithTwoTestsEach").append(DYNAMIC_CONTAINER_SEGMENT_TYPE, //
"#1").append(DYNAMIC_CONTAINER_SEGMENT_TYPE, //
"#1").append(DYNAMIC_TEST_SEGMENT_TYPE, "#2");
EngineExecutionResults executionResults = executeTests(selectUniqueId(uniqueId));
//
executionResults.allEvents().assertEventsMatchExactly(//
event(engine(), started()), //
event(container(MyDynamicTestCase.class), started()), //
event(container("twoNestedContainersWithTwoTestsEach"), started()), //
event(dynamicTestRegistered(displayName("a"))), //
event(container(displayName("a")), started()), //
event(dynamicTestRegistered(displayName("a1"))), //
event(container(displayName("a1")), started()), //
event(dynamicTestRegistered("dynamic-test:#2")), //
event(test("dynamic-test:#2", "failingTest"), started()), //
event(test("dynamic-test:#2", "failingTest"), finishedWithFailure(message("failing"))), //
event(container(displayName("a1")), finishedSuccessfully()), //
event(container(displayName("a")), finishedSuccessfully()), //
event(container("twoNestedContainersWithTwoTestsEach"), finishedSuccessfully()), //
event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class NestedTestClassesTests method extendedNestedTestsAreExecuted.
@Test
void extendedNestedTestsAreExecuted() {
EngineExecutionResults executionResults = executeTestsForClass(TestCaseWithExtendedNested.class);
executionResults.allEvents().debug();
Events containers = executionResults.containerEvents();
Events tests = executionResults.testEvents();
assertEquals(6, tests.started().count(), "# tests started");
assertEquals(4, tests.succeeded().count(), "# tests succeeded");
assertEquals(2, tests.failed().count(), "# tests failed");
assertEquals(8, containers.started().count(), "# containers started");
assertEquals(8, containers.finished().count(), "# containers finished");
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class NestedTestClassesTests method doublyNestedTestsAreExecuted.
@Test
void doublyNestedTestsAreExecuted() {
EngineExecutionResults executionResults = executeTestsForClass(TestCaseWithDoubleNesting.class);
Events containers = executionResults.containerEvents();
Events tests = executionResults.testEvents();
assertEquals(5, tests.started().count(), "# tests started");
assertEquals(3, tests.succeeded().count(), "# tests succeeded");
assertEquals(2, tests.failed().count(), "# tests failed");
assertEquals(4, containers.started().count(), "# containers started");
assertEquals(4, containers.finished().count(), "# containers finished");
assertAll(//
"before each counts", () -> assertEquals(5, TestCaseWithDoubleNesting.beforeTopCount), () -> assertEquals(4, TestCaseWithDoubleNesting.beforeNestedCount), () -> assertEquals(2, TestCaseWithDoubleNesting.beforeDoublyNestedCount));
assertAll(//
"after each counts", () -> assertEquals(5, TestCaseWithDoubleNesting.afterTopCount), () -> assertEquals(4, TestCaseWithDoubleNesting.afterNestedCount), () -> assertEquals(2, TestCaseWithDoubleNesting.afterDoublyNestedCount));
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class NestedTestClassesTests method nestedTestsAreExecuted.
@Test
void nestedTestsAreExecuted() {
EngineExecutionResults executionResults = executeTestsForClass(TestCaseWithNesting.class);
Events containers = executionResults.containerEvents();
Events tests = executionResults.testEvents();
assertEquals(3, tests.started().count(), "# tests started");
assertEquals(2, tests.succeeded().count(), "# tests succeeded");
assertEquals(1, tests.failed().count(), "# tests failed");
assertEquals(3, containers.started().count(), "# containers started");
assertEquals(3, containers.finished().count(), "# containers finished");
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class TestClassInheritanceTests method executeSingleTest.
@Test
void executeSingleTest() {
EngineExecutionResults executionResults = executeTests(selectMethod(LocalTestCase.class, "alwaysPasses"));
assertEquals(1, executionResults.testEvents().started().count(), "# tests started");
assertEquals(1, executionResults.testEvents().succeeded().count(), "# tests succeeded");
assertEquals(0, executionResults.testEvents().skipped().count(), "# tests skipped");
assertEquals(0, executionResults.testEvents().aborted().count(), "# tests aborted");
assertEquals(0, executionResults.testEvents().failed().count(), "# tests failed");
}
Aggregations