use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class ExceptionHandlingTests method checkedExceptionInTestMethodIsRegistered.
@Test
void checkedExceptionInTestMethodIsRegistered() throws NoSuchMethodException {
Method method = FailureTestCase.class.getDeclaredMethod("testWithCheckedException");
LauncherDiscoveryRequest request = request().selectors(selectMethod(FailureTestCase.class, method)).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(1, eventRecorder.getTestFailedCount(), "# tests failed");
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getFailedTestFinishedEvents(), event(test("testWithCheckedException"), finishedWithFailure(allOf(isA(IOException.class), message("checked")))));
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class InvalidLifecycleMethodConfigurationTests method assertExecutionResults.
private void assertExecutionResults(Class<?> invalidTestClass) {
LauncherDiscoveryRequest request = request().selectors(selectClass(TestCase.class), selectClass(invalidTestClass)).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
// @formatter:off
assertAll(() -> assertEquals(3, eventRecorder.getContainerStartedCount(), "# containers started"), () -> assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started"), () -> assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded"), () -> assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed"), () -> assertEquals(3, eventRecorder.getContainerFinishedCount(), "# containers finished"), () -> assertEquals(1, eventRecorder.getContainerFailedCount(), "# containers failed"));
// @formatter:on
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class NestedTestClassesTests method inheritedNestedTestsAreExecuted.
@Test
void inheritedNestedTestsAreExecuted() {
ExecutionEventRecorder eventRecorder = executeTestsForClass(TestCaseWithInheritedNested.class);
assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(1, eventRecorder.getTestFailedCount(), "# tests failed");
assertEquals(3, eventRecorder.getContainerStartedCount(), "# containers started");
assertEquals(3, eventRecorder.getContainerFinishedCount(), "# containers finished");
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class AbstractJupiterTestEngineTests method executeTests.
protected ExecutionEventRecorder executeTests(LauncherDiscoveryRequest request) {
TestDescriptor testDescriptor = discoverTests(request);
ExecutionEventRecorder eventRecorder = new ExecutionEventRecorder();
engine.execute(new ExecutionRequest(testDescriptor, eventRecorder, request.getConfigurationParameters()));
return eventRecorder;
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class BeforeAllAndAfterAllComposedAnnotationTests method beforeAllAndAfterAllAsMetaAnnotations.
@Test
void beforeAllAndAfterAllAsMetaAnnotations() {
ExecutionEventRecorder eventRecorder = executeTestsForClass(TestCase.class);
assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(asList("beforeAll", "test", "afterAll"), methodsInvoked);
}
Aggregations