use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method templateWithSingleRegisteredExtensionIsInvoked.
@Test
void templateWithSingleRegisteredExtensionIsInvoked() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithSingleRegisteredExtension")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithSingleRegisteredExtension"), started()), //
event(dynamicTestRegistered("test-template-invocation:#1")), //
event(test("test-template-invocation:#1"), started()), event(test("test-template-invocation:#1"), //
finishedWithFailure(message("invocation is expected to fail"))), event(container("templateWithSingleRegisteredExtension"), finishedSuccessfully())));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class DynamicNodeGenerationTests method allDynamicTestInNestedDynamicContainerAreExecutedWhenContainerIsDiscoveredByUniqueId.
@Test
void allDynamicTestInNestedDynamicContainerAreExecutedWhenContainerIsDiscoveredByUniqueId() {
UniqueId uniqueId = //
discoverUniqueId(MyDynamicTestCase.class, "twoNestedContainersWithTwoTestsEach").append(DYNAMIC_CONTAINER_SEGMENT_TYPE, //
"#2").append(DYNAMIC_CONTAINER_SEGMENT_TYPE, "#1");
ExecutionEventRecorder eventRecorder = executeTests(selectUniqueId(uniqueId));
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), //
event(engine(), started()), //
event(container(MyDynamicTestCase.class), started()), //
event(container("twoNestedContainersWithTwoTestsEach"), started()), //
event(dynamicTestRegistered(displayName("b"))), //
event(container(displayName("b")), started()), //
event(dynamicTestRegistered(displayName("b1"))), //
event(container(displayName("b1")), 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(displayName("b1")), finishedSuccessfully()), //
event(container(displayName("b")), finishedSuccessfully()), //
event(container("twoNestedContainersWithTwoTestsEach"), finishedSuccessfully()), //
event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class DynamicNodeGenerationTests method dynamicTestsAreExecutedFromIterable.
@Test
void dynamicTestsAreExecutedFromIterable() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyDynamicTestCase.class, "dynamicIterable")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
// @TestFactory methods are counted as both container and test
assertAll(() -> assertEquals(3, eventRecorder.getContainerStartedCount(), "# container started"), () -> assertEquals(2, eventRecorder.getDynamicTestRegisteredCount(), "# dynamic registered"), () -> assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started"), () -> assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded"), () -> assertEquals(1, eventRecorder.getTestFailedCount(), "# tests failed"), () -> assertEquals(3, eventRecorder.getContainerFinishedCount(), "# container finished"));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class DynamicNodeGenerationTests method dynamicTestsAreExecutedFromIterator.
@Test
void dynamicTestsAreExecutedFromIterator() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyDynamicTestCase.class, "dynamicIterator")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertAll(() -> assertEquals(3, eventRecorder.getContainerStartedCount(), "# container started"), () -> assertEquals(2, eventRecorder.getDynamicTestRegisteredCount(), "# dynamic registered"), () -> assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started"), () -> assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded"), () -> assertEquals(1, eventRecorder.getTestFailedCount(), "# tests failed"), () -> assertEquals(3, eventRecorder.getContainerFinishedCount(), "# container finished"));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class DynamicNodeGenerationTests method dynamicTestsAreExecutedFromCollection.
@Test
void dynamicTestsAreExecutedFromCollection() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyDynamicTestCase.class, "dynamicCollection")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertAll(() -> assertEquals(3, eventRecorder.getContainerStartedCount(), "# container started"), () -> assertEquals(2, eventRecorder.getDynamicTestRegisteredCount(), "# dynamic registered"), () -> assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started"), () -> assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded"), () -> assertEquals(1, eventRecorder.getTestFailedCount(), "# tests failed"), () -> assertEquals(3, eventRecorder.getContainerFinishedCount(), "# container finished"));
}
Aggregations