use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method legacyReportingNames.
@Test
void legacyReportingNames() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithTwoRegisteredExtensions")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
// @formatter:off
Stream<String> legacyReportingNames = eventRecorder.getExecutionEvents().stream().filter(event -> event.getType() == DYNAMIC_TEST_REGISTERED).map(ExecutionEvent::getTestDescriptor).map(TestDescriptor::getLegacyReportingName);
// @formatter:off
assertThat(legacyReportingNames).containsExactly("templateWithTwoRegisteredExtensions()[1]", "templateWithTwoRegisteredExtensions()[2]");
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method templateWithTwoRegisteredExtensionsIsInvoked.
@Test
void templateWithTwoRegisteredExtensionsIsInvoked() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithTwoRegisteredExtensions")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithTwoRegisteredExtensions"), started()), //
event(dynamicTestRegistered("test-template-invocation:#1"), displayName("[1]")), //
event(test("test-template-invocation:#1"), started()), event(test("test-template-invocation:#1"), //
finishedWithFailure(message("invocation is expected to fail"))), //
event(dynamicTestRegistered("test-template-invocation:#2"), displayName("[2]")), //
event(test("test-template-invocation:#2"), started()), event(test("test-template-invocation:#2"), //
finishedWithFailure(message("invocation is expected to fail"))), event(container("templateWithTwoRegisteredExtensions"), finishedSuccessfully())));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method singleInvocationIsExecutedWhenDiscoveredByUniqueId.
@Test
void singleInvocationIsExecutedWhenDiscoveredByUniqueId() {
UniqueId uniqueId = discoverUniqueId(MyTestTemplateTestCase.class, //
"templateWithTwoInvocationsFromSingleExtension").append(TestTemplateInvocationTestDescriptor.SEGMENT_TYPE, "#2");
ExecutionEventRecorder eventRecorder = executeTests(selectUniqueId(uniqueId));
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithTwoInvocationsFromSingleExtension"), started()), //
event(dynamicTestRegistered("test-template-invocation:#2"), displayName("[2]")), //
event(test("test-template-invocation:#2"), started()), event(test("test-template-invocation:#2"), //
finishedWithFailure(message("invocation is expected to fail"))), event(container("templateWithTwoInvocationsFromSingleExtension"), finishedSuccessfully())));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method templateWithCustomizedDisplayNamesIsInvoked.
@Test
void templateWithCustomizedDisplayNamesIsInvoked() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithCustomizedDisplayNames")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithCustomizedDisplayNames"), started()), event(dynamicTestRegistered("test-template-invocation:#1"), //
displayName("1 --> templateWithCustomizedDisplayNames()")), //
event(test("test-template-invocation:#1"), started()), event(test("test-template-invocation:#1"), //
finishedWithFailure(message("invocation is expected to fail"))), event(container("templateWithCustomizedDisplayNames"), finishedSuccessfully())));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method contextParameterResolverCanResolveConstructorArguments.
@Test
void contextParameterResolverCanResolveConstructorArguments() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCaseWithConstructor.class, "template", "java.lang.String")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("template"), started()), //
event(dynamicTestRegistered("test-template-invocation:#1"), displayName("[1] foo")), //
event(test("test-template-invocation:#1"), started()), //
event(test("test-template-invocation:#1"), finishedSuccessfully()), //
event(dynamicTestRegistered("test-template-invocation:#2"), displayName("[2] bar")), //
event(test("test-template-invocation:#2"), started()), //
event(test("test-template-invocation:#2"), finishedSuccessfully()), event(container("template"), finishedSuccessfully())));
}
Aggregations