use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class DiscoveryTests method discoverTestTemplateMethodByMethodSelector.
@Test
void discoverTestTemplateMethodByMethodSelector() {
LauncherDiscoveryRequest spec = request().selectors(selectMethod(TestTemplateClass.class, "testTemplate")).build();
TestDescriptor engineDescriptor = discoverTests(spec);
assertEquals(2, engineDescriptor.getDescendants().size(), "# resolved test descriptors");
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class DiscoveryTests method discoverCompositeSpec.
@Test
void discoverCompositeSpec() {
LauncherDiscoveryRequest spec = request().selectors(selectUniqueId(JupiterUniqueIdBuilder.uniqueIdForMethod(LocalTestCase.class, "test2()")), selectClass(LocalTestCase.class)).build();
TestDescriptor engineDescriptor = discoverTests(spec);
assertEquals(7, engineDescriptor.getDescendants().size(), "# resolved test descriptors");
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class DiscoveryTests method doNotDiscoverAbstractTestClass.
@Test
void doNotDiscoverAbstractTestClass() {
LauncherDiscoveryRequest request = request().selectors(selectClass(AbstractTestCase.class)).build();
TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(0, engineDescriptor.getDescendants().size(), "# resolved test descriptors");
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class DefaultLauncherTests method launcherWillExecuteEnginesHonoringBothIncludeAndExcludeEngineFilters.
@Test
void launcherWillExecuteEnginesHonoringBothIncludeAndExcludeEngineFilters() {
DemoHierarchicalTestEngine firstEngine = new DemoHierarchicalTestEngine("first");
TestDescriptor test1 = firstEngine.addTest("test1", noOp);
DemoHierarchicalTestEngine secondEngine = new DemoHierarchicalTestEngine("second");
TestDescriptor test2 = secondEngine.addTest("test2", noOp);
DemoHierarchicalTestEngine thirdEngine = new DemoHierarchicalTestEngine("third");
TestDescriptor test3 = thirdEngine.addTest("test3", noOp);
DefaultLauncher launcher = createLauncher(firstEngine, secondEngine, thirdEngine);
// @formatter:off
TestPlan testPlan = launcher.discover(request().selectors(selectUniqueId(test1.getUniqueId()), selectUniqueId(test2.getUniqueId()), selectUniqueId(test3.getUniqueId())).filters(includeEngines("first", "second"), excludeEngines("second")).build());
// @formatter:on
assertThat(testPlan.getRoots()).hasSize(1);
TestIdentifier rootIdentifier = testPlan.getRoots().iterator().next();
assertThat(testPlan.getChildren(rootIdentifier.getUniqueId())).hasSize(1);
assertThat(testPlan.getChildren(UniqueId.forEngine("first").toString())).hasSize(1);
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class DefaultLauncherTests method launcherWillNotExecuteEnginesIfNotIncludedByAnEngineFilter.
@Test
void launcherWillNotExecuteEnginesIfNotIncludedByAnEngineFilter() {
DemoHierarchicalTestEngine firstEngine = new DemoHierarchicalTestEngine("first");
TestDescriptor test1 = firstEngine.addTest("test1", noOp);
DemoHierarchicalTestEngine secondEngine = new DemoHierarchicalTestEngine("second");
TestDescriptor test2 = secondEngine.addTest("test2", noOp);
DefaultLauncher launcher = createLauncher(firstEngine, secondEngine);
// @formatter:off
TestPlan testPlan = launcher.discover(request().selectors(selectUniqueId(test1.getUniqueId()), selectUniqueId(test2.getUniqueId())).filters(includeEngines("first")).build());
// @formatter:on
assertThat(testPlan.getRoots()).hasSize(1);
TestIdentifier rootIdentifier = testPlan.getRoots().iterator().next();
assertThat(testPlan.getChildren(rootIdentifier.getUniqueId())).hasSize(1);
assertThat(testPlan.getChildren(UniqueId.forEngine("first").toString())).hasSize(1);
}
Aggregations