use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method resolvesUniqueIdSelectorOfSingleClassWithinSuite.
@Test
void resolvesUniqueIdSelectorOfSingleClassWithinSuite() throws Exception {
Class<?> suiteClass = JUnit4SuiteWithTwoTestCases.class;
Class<?> testClass = PlainJUnit4TestCaseWithSingleTestWhichFails.class;
LauncherDiscoveryRequest discoveryRequest = request().selectors(selectUniqueId(VintageUniqueIdBuilder.uniqueIdForClasses(suiteClass, testClass))).build();
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, "failingTest", VintageUniqueIdBuilder.uniqueIdForClasses(suiteClass, testClass));
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method resolvesClassesWithInheritedMethods.
@Test
void resolvesClassesWithInheritedMethods() throws Exception {
Class<?> superclass = PlainJUnit4TestCaseWithSingleTestWhichFails.class;
Class<?> testClass = PlainJUnit4TestCaseWithSingleInheritedTestWhichFails.class;
LauncherDiscoveryRequest discoveryRequest = discoveryRequestForClass(testClass);
TestDescriptor engineDescriptor = discoverTests(discoveryRequest);
TestDescriptor runnerDescriptor = getOnlyElement(engineDescriptor.getChildren());
assertEquals(testClass.getName(), runnerDescriptor.getDisplayName());
assertClassSource(testClass, runnerDescriptor);
TestDescriptor testDescriptor = getOnlyElement(runnerDescriptor.getChildren());
assertEquals("failingTest", testDescriptor.getDisplayName());
assertMethodSource(superclass.getMethod("failingTest"), testDescriptor);
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method resolvesUniqueIdSelectorForSingleClass.
@Test
void resolvesUniqueIdSelectorForSingleClass() {
Class<?> testClass = PlainJUnit4TestCaseWithFiveTestMethods.class;
LauncherDiscoveryRequest discoveryRequest = request().selectors(selectUniqueId(VintageUniqueIdBuilder.uniqueIdForClass(testClass))).build();
TestDescriptor engineDescriptor = discoverTests(discoveryRequest);
TestDescriptor runnerDescriptor = getOnlyElement(engineDescriptor.getChildren());
assertRunnerTestDescriptor(runnerDescriptor, testClass);
assertThat(runnerDescriptor.getChildren()).hasSize(5);
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method ignoresRedundantSelector.
@Test
void ignoresRedundantSelector() throws Exception {
Class<?> testClass = PlainJUnit4TestCaseWithFiveTestMethods.class;
LauncherDiscoveryRequest discoveryRequest = //
request().selectors(//
selectMethod(testClass, testClass.getMethod("failingTest")), selectUniqueId(//
VintageUniqueIdBuilder.uniqueIdForMethod(testClass, "failingTest"))).build();
TestDescriptor engineDescriptor = discoverTests(discoveryRequest);
TestDescriptor runnerDescriptor = getOnlyElement(engineDescriptor.getChildren());
assertRunnerTestDescriptor(runnerDescriptor, testClass);
TestDescriptor testMethodDescriptor = getOnlyElement(runnerDescriptor.getChildren());
assertTestMethodDescriptor(testMethodDescriptor, testClass, "failingTest", VintageUniqueIdBuilder.uniqueIdForClass(testClass));
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class VintageTestEngineDiscoveryTests method resolvesUniqueIdSelectorOfSingleMethodWithinSuite.
@Test
void resolvesUniqueIdSelectorOfSingleMethodWithinSuite() throws Exception {
Class<?> suiteClass = JUnit4SuiteWithTwoTestCases.class;
Class<?> testClass = PlainJUnit4TestCaseWithTwoTestMethods.class;
LauncherDiscoveryRequest discoveryRequest = request().selectors(selectUniqueId(VintageUniqueIdBuilder.uniqueIdForMethod(VintageUniqueIdBuilder.uniqueIdForClasses(suiteClass, testClass), testClass, "successfulTest"))).build();
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, "successfulTest", VintageUniqueIdBuilder.uniqueIdForClasses(suiteClass, testClass));
}
Aggregations