use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class DefaultMethodTests method executeTestCaseWithOverriddenGenericDefaultMethodSelectedByClass.
@Test
void executeTestCaseWithOverriddenGenericDefaultMethodSelectedByClass() throws Exception {
Class<?> clazz = GenericTestCaseWithOverriddenDefaultMethod.class;
LauncherDiscoveryRequest request = request().selectors(selectClass(clazz)).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
// @formatter:off
assertAll(() -> assertTrue(beforeAllInvoked, "@BeforeAll default method invoked from interface"), () -> assertTrue(afterAllInvoked, "@AfterAll default method invoked from interface"), () -> assertFalse(defaultMethodInvoked, "default @Test method should not have been invoked from interface"), () -> assertTrue(overriddenDefaultMethodInvoked, "overridden default @Test method invoked from interface"), () -> assertTrue(localMethodInvoked, "local @Test method invoked from class"), // should not have been "discovered" since it is overridden.
() -> assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started"), () -> assertEquals(2, eventRecorder.getTestSuccessfulCount(), "# tests succeeded"), () -> assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed"));
// @formatter:on
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class ReportingTests method threeReportEntriesArePublished.
@Test
void threeReportEntriesArePublished() {
LauncherDiscoveryRequest request = request().selectors(selectClass(MyReportingTestCase.class)).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(2, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed");
assertEquals(6, eventRecorder.getReportingEntryPublishedCount(), "# report entries published");
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class StandardTestClassTests method allTestsInClassAreRunWithAfterEach.
@Test
void allTestsInClassAreRunWithAfterEach() {
ExecutionEventRecorder eventRecorder = executeTestsForClass(MyStandardTestCase.class);
assertEquals(4, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(4, MyStandardTestCase.countAfter, "# after each calls");
assertEquals(2, eventRecorder.getContainerStartedCount(), "# containers started");
assertEquals(2, eventRecorder.getContainerFinishedCount(), "# containers finished");
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class StandardTestClassTests method allTestsInClassAreRunWithBeforeEach.
@Test
void allTestsInClassAreRunWithBeforeEach() {
ExecutionEventRecorder eventRecorder = executeTestsForClass(MyStandardTestCase.class);
assertEquals(4, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(2, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(1, eventRecorder.getTestAbortedCount(), "# tests aborted");
assertEquals(1, eventRecorder.getTestFailedCount(), "# tests failed");
assertEquals(2, eventRecorder.getContainerStartedCount(), "# containers started");
assertEquals(2, eventRecorder.getContainerFinishedCount(), "# containers finished");
assertEquals(4, MyStandardTestCase.countBefore1, "# before1 calls");
assertEquals(4, MyStandardTestCase.countBefore2, "# before2 calls");
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class TestCaseWithInheritanceTests method executeAllTestsInClass.
@Test
void executeAllTestsInClass() {
ExecutionEventRecorder eventRecorder = executeTestsForClass(LocalTestCase.class);
assertEquals(6, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(3, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(0, eventRecorder.getTestSkippedCount(), "# tests skipped");
assertEquals(1, eventRecorder.getTestAbortedCount(), "# tests aborted");
assertEquals(2, eventRecorder.getTestFailedCount(), "# tests failed");
assertEquals(6, LocalTestCase.countBeforeInvoked, "# before calls");
assertEquals(6, LocalTestCase.countAfterInvoked, "# after calls");
assertEquals(6, AbstractTestCase.countSuperBeforeInvoked, "# super before calls");
assertEquals(6, AbstractTestCase.countSuperAfterInvoked, "# super after calls");
}
Aggregations