use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class DynamicNodeGenerationTests method dynamicContainersChildrenMustNotBeNull.
@Test
void dynamicContainersChildrenMustNotBeNull() {
EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "dynamicContainerWithNullChildren"));
//
executionResults.allEvents().assertEventsMatchExactly(//
event(engine(), started()), //
event(container(MyDynamicTestCase.class), started()), //
event(container("dynamicContainerWithNullChildren"), started()), //
event(dynamicTestRegistered("dynamic-container:#1")), //
event(container("dynamic-container:#1"), started()), event(//
container("dynamic-container:#1"), //
finishedWithFailure(message("individual dynamic node must not be null"))), //
event(container("dynamicContainerWithNullChildren"), 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 DynamicNodeGenerationTests method dynamicTestsAreExecutedFromStream.
@Test
void dynamicTestsAreExecutedFromStream() {
EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "dynamicStream"));
//
executionResults.allEvents().assertEventsMatchExactly(//
event(engine(), started()), //
event(container(MyDynamicTestCase.class), started()), //
event(container("dynamicStream"), started()), //
event(dynamicTestRegistered("dynamic-test:#1")), //
event(test("dynamic-test:#1", "succeedingTest"), started()), //
event(test("dynamic-test:#1", "succeedingTest"), finishedSuccessfully()), //
event(dynamicTestRegistered("dynamic-test:#2")), //
event(test("dynamic-test:#2", "failingTest"), started()), //
event(test("dynamic-test:#2", "failingTest"), finishedWithFailure(message("failing"))), //
event(container("dynamicStream"), 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 DynamicNodeGenerationTests method dynamicContainersAreExecutedFromExceptionThrowingStream.
@Test
void dynamicContainersAreExecutedFromExceptionThrowingStream() {
EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "dynamicContainerWithExceptionThrowingStream"));
assertTrue(MyDynamicTestCase.exceptionThrowingStreamClosed.get(), "stream should be closed");
//
executionResults.allEvents().assertEventsMatchExactly(//
event(engine(), started()), //
event(container(MyDynamicTestCase.class), started()), //
event(container("dynamicContainerWithExceptionThrowingStream"), started()), //
event(dynamicTestRegistered("dynamic-container:#1")), //
event(container("dynamic-container:#1"), started()), //
event(dynamicTestRegistered("dynamic-test:#1")), //
event(test("dynamic-test:#1", "succeedingTest"), started()), //
event(test("dynamic-test:#1", "succeedingTest"), finishedSuccessfully()), //
event(dynamicTestRegistered("dynamic-test:#2")), //
event(test("dynamic-test:#2", "failingTest"), started()), //
event(test("dynamic-test:#2", "failingTest"), finishedWithFailure(message("failing"))), event(container("dynamic-container:#1"), //
finishedWithFailure(instanceOf(ArrayIndexOutOfBoundsException.class))), //
event(container("dynamicContainerWithExceptionThrowingStream"), finishedSuccessfully()), //
event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
Events containers = executionResults.containerEvents();
Events tests = executionResults.testEvents();
assertAll(() -> assertEquals(4, containers.started().count(), "# container started"), () -> assertEquals(1, containers.dynamicallyRegistered().count(), "# dynamic containers registered"), () -> assertEquals(2, tests.dynamicallyRegistered().count(), "# dynamic tests registered"), () -> assertEquals(2, tests.started().count(), "# tests started"), () -> assertEquals(1, tests.succeeded().count(), "# tests succeeded"), () -> assertEquals(1, tests.failed().count(), "# tests failed"), () -> assertEquals(4, containers.finished().count(), "# container finished"));
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class DynamicNodeGenerationTests method testFactoryMethodsMayReturnSingleDynamicTest.
@Test
void testFactoryMethodsMayReturnSingleDynamicTest() {
EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "singleTest"));
//
executionResults.allEvents().assertEventsMatchExactly(//
event(engine(), started()), //
event(container(MyDynamicTestCase.class), started()), //
event(container("singleTest"), started()), //
event(dynamicTestRegistered("dynamic-test:#1")), //
event(test("dynamic-test:#1", "succeedingTest"), started()), //
event(test("dynamic-test:#1", "succeedingTest"), finishedSuccessfully()), //
event(container("singleTest"), 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 DynamicNodeGenerationTests method testFactoryMethodsMayReturnSingleDynamicContainer.
@Test
void testFactoryMethodsMayReturnSingleDynamicContainer() {
EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "singleContainer"));
//
executionResults.allEvents().assertEventsMatchExactly(//
event(engine(), started()), //
event(container(MyDynamicTestCase.class), started()), //
event(container("singleContainer"), started()), //
event(dynamicTestRegistered("dynamic-container:#1")), //
event(container("dynamic-container:#1"), started()), //
event(dynamicTestRegistered("dynamic-test:#1")), //
event(test("dynamic-test:#1", "succeedingTest"), started()), //
event(test("dynamic-test:#1", "succeedingTest"), finishedSuccessfully()), //
event(dynamicTestRegistered("dynamic-test:#2")), //
event(test("dynamic-test:#2", "failingTest"), started()), //
event(test("dynamic-test:#2", "failingTest"), finishedWithFailure(message("failing"))), //
event(container("dynamic-container:#1"), finishedSuccessfully()), //
event(container("singleContainer"), finishedSuccessfully()), //
event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
}
Aggregations