use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class StandardTestClassTests method moreThanOneTestClassIsCorrectlyDiscovered.
@Test
void moreThanOneTestClassIsCorrectlyDiscovered() {
LauncherDiscoveryRequest request = request().selectors(selectClass(SecondOfTwoTestCases.class)).build();
TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(2 + 2, engineDescriptor.getDescendants().size(), "# resolved test descriptors");
}
use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class TestCaseWithInheritanceTests method executeTestDeclaredInSuperClass.
@Test
void executeTestDeclaredInSuperClass() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(LocalTestCase.class, "superTest")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(0, eventRecorder.getTestSkippedCount(), "# tests skipped");
assertEquals(0, eventRecorder.getTestAbortedCount(), "# tests aborted");
assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed");
assertEquals(1, LocalTestCase.countBeforeInvoked, "# after calls");
assertEquals(1, LocalTestCase.countAfterInvoked, "# after calls");
assertEquals(1, AbstractTestCase.countSuperBeforeInvoked, "# super before calls");
assertEquals(1, AbstractTestCase.countSuperAfterInvoked, "# super after calls");
}
use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class TestCaseWithInheritanceTests method executeTestWithExceptionThrownInAfterMethod.
@Test
void executeTestWithExceptionThrownInAfterMethod() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(LocalTestCase.class, "throwExceptionInAfterMethod")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(0, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(0, eventRecorder.getTestSkippedCount(), "# tests skipped");
assertEquals(0, eventRecorder.getTestAbortedCount(), "# tests aborted");
assertEquals(1, eventRecorder.getTestFailedCount(), "# tests failed");
}
use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class TestTemplateInvocationTests method templateWithTwoInvocationsFromSingleExtensionIsInvoked.
@Test
void templateWithTwoInvocationsFromSingleExtensionIsInvoked() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithTwoInvocationsFromSingleExtension")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithTwoInvocationsFromSingleExtension"), 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("templateWithTwoInvocationsFromSingleExtension"), finishedSuccessfully())));
}
use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class TestTemplateInvocationTests method disabledTemplateIsSkipped.
@Test
void disabledTemplateIsSkipped() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "disabledTemplate")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, event(container("disabledTemplate"), skippedWithReason("always disabled"))));
}
Aggregations