use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class BeforeEachAndAfterEachComposedAnnotationTests method beforeEachAndAfterEachAsMetaAnnotations.
@Test
void beforeEachAndAfterEachAsMetaAnnotations() {
ExecutionEventRecorder eventRecorder = executeTestsForClass(TestCase.class);
assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(asList("beforeEach", "test", "afterEach"), methodsInvoked);
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class DefaultMethodTests method executeTestCaseWithDefaultMethodFromGenericInterfaceSelectedByFullyQualifedMethodName.
@Test
void executeTestCaseWithDefaultMethodFromGenericInterfaceSelectedByFullyQualifedMethodName() throws Exception {
String fqmn = GenericTestCaseWithDefaultMethod.class.getName() + "#test(" + Long.class.getName() + ")";
LauncherDiscoveryRequest request = request().selectors(selectMethod(fqmn)).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
// @formatter:off
assertAll(() -> assertTrue(beforeAllInvoked, "@BeforeAll default method invoked from interface"), () -> assertTrue(afterAllInvoked, "@AfterAll default method invoked from interface"), () -> assertTrue(defaultMethodInvoked, "default @Test method invoked from interface"), () -> assertFalse(localMethodInvoked, "local @Test method should not have been invoked from class"), () -> assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started"), () -> assertEquals(1, 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 DefaultMethodTests method executeTestCaseWithOverloadedMethodNextToGenericDefaultMethodSelectedByFullyQualifedMethodName.
@Test
void executeTestCaseWithOverloadedMethodNextToGenericDefaultMethodSelectedByFullyQualifedMethodName() throws Exception {
String fqmn = GenericTestCaseWithDefaultMethod.class.getName() + "#test(" + Double.class.getName() + ")";
LauncherDiscoveryRequest request = request().selectors(selectMethod(fqmn)).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(localMethodInvoked, "local @Test method invoked from class"), () -> assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started"), () -> assertEquals(1, 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 BridgeMethodTests method execute.
private String execute(int expectedTestFinishedCount, Class<?> testClass) {
sequence.clear();
ExecutionEventRecorder recorder = executeTestsForClass(testClass);
assertEquals(expectedTestFinishedCount, recorder.getTestFinishedCount());
return sequence.toString();
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class ExecutionConditionTests method assertExecutionConditionOverride.
private void assertExecutionConditionOverride(String deactivatePattern, int testStartedCount, int testFailedCount) {
// @formatter:off
LauncherDiscoveryRequest request = request().selectors(selectClass(TestCaseWithExecutionConditionOnClass.class)).configurationParameter(DEACTIVATE_CONDITIONS_PATTERN_PROPERTY_NAME, deactivatePattern).build();
// @formatter:on
ExecutionEventRecorder eventRecorder = executeTests(request);
assertEquals(0, eventRecorder.getContainerSkippedCount(), "# containers skipped");
assertEquals(2, eventRecorder.getContainerStartedCount(), "# containers started");
assertEquals(testStartedCount, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(testFailedCount, eventRecorder.getTestFailedCount(), "# tests failed");
}
Aggregations