use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method resolvesJUnit4SuiteWithPlainJUnit4TestCaseWithSingleTestWhichIsIgnored.
@Test
void resolvesJUnit4SuiteWithPlainJUnit4TestCaseWithSingleTestWhichIsIgnored() throws Exception {
Class<?> suiteClass = JUnit4SuiteWithPlainJUnit4TestCaseWithSingleTestWhichIsIgnored.class;
Class<?> testClass = PlainJUnit4TestCaseWithSingleTestWhichIsIgnored.class;
LauncherDiscoveryRequest discoveryRequest = discoveryRequestForClass(suiteClass);
TestDescriptor engineDescriptor = discoverTests(discoveryRequest);
TestDescriptor suiteDescriptor = getOnlyElement(engineDescriptor.getChildren());
assertRunnerTestDescriptor(suiteDescriptor, suiteClass);
TestDescriptor testClassDescriptor = getOnlyElement(suiteDescriptor.getChildren());
assertContainerTestDescriptor(testClassDescriptor, suiteClass, testClass);
TestDescriptor testMethodDescriptor = getOnlyElement(testClassDescriptor.getChildren());
assertTestMethodDescriptor(testMethodDescriptor, testClass, "ignoredTest", VintageUniqueIdBuilder.uniqueIdForClasses(suiteClass, testClass));
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method resolvesApplyingPackageNameFilters.
@Test
void resolvesApplyingPackageNameFilters() throws Exception {
Path root = getClasspathRoot(PlainJUnit4TestCaseWithSingleTestWhichFails.class);
LauncherDiscoveryRequest discoveryRequest = request().selectors(selectClasspathRoots(singleton(root))).filters(includePackageNames("org"), includePackageNames("org.junit")).build();
TestDescriptor engineDescriptor = discoverTests(discoveryRequest);
// @formatter:off
assertThat(engineDescriptor.getChildren()).extracting(TestDescriptor::getDisplayName).contains(PlainJUnit4TestCaseWithSingleTestWhichFails.class.getName());
// @formatter:on
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method resolvesClasspathSelector.
@Test
void resolvesClasspathSelector() throws Exception {
Path root = getClasspathRoot(PlainJUnit4TestCaseWithSingleTestWhichFails.class);
LauncherDiscoveryRequest discoveryRequest = request().selectors(selectClasspathRoots(singleton(root))).build();
TestDescriptor engineDescriptor = discoverTests(discoveryRequest);
// @formatter:off
assertThat(engineDescriptor.getChildren()).extracting(TestDescriptor::getDisplayName).contains(PlainJUnit4TestCaseWithSingleTestWhichFails.class.getName()).contains(PlainJUnit3TestCaseWithSingleTestWhichFails.class.getName()).doesNotContain(PlainOldJavaClassWithoutAnyTest.class.getName());
// @formatter:on
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method resolvesMethodOfIgnoredJUnit4TestClass.
@Test
void resolvesMethodOfIgnoredJUnit4TestClass() throws Exception {
Class<?> testClass = IgnoredJUnit4TestCase.class;
LauncherDiscoveryRequest discoveryRequest = request().selectors(selectMethod(testClass, testClass.getMethod("failingTest"))).build();
TestDescriptor engineDescriptor = discoverTests(discoveryRequest);
TestDescriptor runnerDescriptor = getOnlyElement(engineDescriptor.getChildren());
assertRunnerTestDescriptor(runnerDescriptor, testClass);
TestDescriptor childDescriptor = getOnlyElement(runnerDescriptor.getChildren());
assertTestMethodDescriptor(childDescriptor, testClass, "failingTest", VintageUniqueIdBuilder.uniqueIdForClass(testClass));
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method ignoresMoreFineGrainedSelectorsWhenClassIsSelectedAsWell.
@Test
void ignoresMoreFineGrainedSelectorsWhenClassIsSelectedAsWell() throws Exception {
Class<?> testClass = PlainJUnit4TestCaseWithFiveTestMethods.class;
LauncherDiscoveryRequest discoveryRequest = //
request().selectors(//
selectMethod(testClass, testClass.getMethod("failingTest")), //
selectUniqueId(VintageUniqueIdBuilder.uniqueIdForMethod(testClass, "abortedTest")), //
selectClass(testClass)).build();
TestDescriptor engineDescriptor = discoverTests(discoveryRequest);
TestDescriptor runnerDescriptor = getOnlyElement(engineDescriptor.getChildren());
assertRunnerTestDescriptor(runnerDescriptor, testClass);
assertThat(runnerDescriptor.getChildren()).hasSize(5);
}
Aggregations