use of org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine in project junit5 by junit-team.
the class DefaultLauncherTests method discoverTestPlanForSingleEngine.
@Test
void discoverTestPlanForSingleEngine() {
DemoHierarchicalTestEngine engine = new DemoHierarchicalTestEngine("myEngine");
engine.addTest("test1", noOp);
engine.addTest("test2", noOp);
DefaultLauncher launcher = createLauncher(engine);
TestPlan testPlan = launcher.discover(request().selectors(selectPackage("any")).build());
assertThat(testPlan.getRoots()).hasSize(1);
TestIdentifier rootIdentifier = testPlan.getRoots().iterator().next();
assertThat(testPlan.getChildren(rootIdentifier.getUniqueId())).hasSize(2);
assertThat(testPlan.getChildren("[engine:myEngine]")).hasSize(2);
}
use of org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine 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);
}
use of org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine in project junit5 by junit-team.
the class DefaultLauncherTests method launcherWillNotExecuteEnginesExplicitlyExcludedByAnEngineFilter.
@Test
void launcherWillNotExecuteEnginesExplicitlyExcludedByAnEngineFilter() {
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(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.support.hierarchical.DemoHierarchicalTestEngine in project junit5 by junit-team.
the class DefaultLauncherTests method discoverTestPlanForMultipleEngines.
@Test
void discoverTestPlanForMultipleEngines() {
DemoHierarchicalTestEngine firstEngine = new DemoHierarchicalTestEngine("engine1");
TestDescriptor test1 = firstEngine.addTest("test1", noOp);
DemoHierarchicalTestEngine secondEngine = new DemoHierarchicalTestEngine("engine2");
TestDescriptor test2 = secondEngine.addTest("test2", noOp);
DefaultLauncher launcher = createLauncher(firstEngine, secondEngine);
TestPlan testPlan = launcher.discover(request().selectors(selectUniqueId(test1.getUniqueId()), selectUniqueId(test2.getUniqueId())).build());
assertThat(testPlan.getRoots()).hasSize(2);
assertThat(testPlan.getChildren(UniqueId.forEngine("engine1").toString())).hasSize(1);
assertThat(testPlan.getChildren(UniqueId.forEngine("engine2").toString())).hasSize(1);
}
Aggregations