use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method templateWithCloseableStream.
@Test
void templateWithCloseableStream() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithCloseableStream")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertThat(InvocationContextProviderWithCloseableStream.streamClosed.get()).describedAs("streamClosed").isTrue();
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithCloseableStream"), started()), //
event(dynamicTestRegistered("test-template-invocation:#1")), //
event(test("test-template-invocation:#1"), started()), //
event(test("test-template-invocation:#1"), finishedSuccessfully()), event(container("templateWithCloseableStream"), finishedSuccessfully())));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method templateWithDynamicTestInstancePostProcessorIsInvoked.
@Test
void templateWithDynamicTestInstancePostProcessorIsInvoked() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithDynamicTestInstancePostProcessor")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithDynamicTestInstancePostProcessor"), started()), //
event(dynamicTestRegistered("test-template-invocation:#1")), //
event(test("test-template-invocation:#1"), started()), //
event(test("test-template-invocation:#1"), finishedWithFailure(message("foo"))), //
event(dynamicTestRegistered("test-template-invocation:#2")), //
event(test("test-template-invocation:#2"), started()), //
event(test("test-template-invocation:#2"), finishedWithFailure(message("bar"))), event(container("templateWithDynamicTestInstancePostProcessor"), finishedSuccessfully())));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method templateWithDisabledInvocationsIsSkipped.
@Test
void templateWithDisabledInvocationsIsSkipped() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithDisabledInvocations")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithDisabledInvocations"), started()), //
event(dynamicTestRegistered("test-template-invocation:#1")), //
event(test("test-template-invocation:#1"), skippedWithReason("always disabled")), event(container("templateWithDisabledInvocations"), finishedSuccessfully())));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method templateWithDynamicParameterResolverIsInvoked.
@Test
void templateWithDynamicParameterResolverIsInvoked() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithDynamicParameterResolver", "java.lang.String")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithDynamicParameterResolver"), started()), //
event(dynamicTestRegistered("test-template-invocation:#1"), displayName("[1] foo")), //
event(test("test-template-invocation:#1"), started()), //
event(test("test-template-invocation:#1"), finishedWithFailure(message("foo"))), //
event(dynamicTestRegistered("test-template-invocation:#2"), displayName("[2] bar")), //
event(test("test-template-invocation:#2"), started()), //
event(test("test-template-invocation:#2"), finishedWithFailure(message("bar"))), event(container("templateWithDynamicParameterResolver"), finishedSuccessfully())));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestTemplateInvocationTests method parentChildRelationshipIsEstablished.
@Test
void parentChildRelationshipIsEstablished() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithSingleRegisteredExtension")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
TestDescriptor templateMethodDescriptor = findTestDescriptor(eventRecorder, container("templateWithSingleRegisteredExtension"));
TestDescriptor invocationDescriptor = findTestDescriptor(eventRecorder, test("test-template-invocation:#1"));
assertThat(invocationDescriptor.getParent()).hasValue(templateMethodDescriptor);
assertThat(templateMethodDescriptor.getChildren()).isEqualTo(singleton(invocationDescriptor));
}
Aggregations