use of org.junit.platform.launcher.Launcher in project junit5 by junit-team.
the class DefaultLauncher method discoverRoot.
private Root discoverRoot(LauncherDiscoveryRequest discoveryRequest, String phase) {
Root root = new Root();
for (TestEngine testEngine : this.testEngines) {
// @formatter:off
boolean engineIsExcluded = discoveryRequest.getEngineFilters().stream().map(engineFilter -> engineFilter.apply(testEngine)).anyMatch(FilterResult::excluded);
if (engineIsExcluded) {
logger.debug(() -> String.format("Test discovery for engine '%s' was skipped due to an EngineFilter in phase '%s'.", testEngine.getId(), phase));
continue;
}
logger.debug(() -> String.format("Discovering tests during Launcher %s phase in engine '%s'.", phase, testEngine.getId()));
Optional<TestDescriptor> engineRoot = discoverEngineRoot(testEngine, discoveryRequest);
engineRoot.ifPresent(rootDescriptor -> root.add(testEngine, rootDescriptor));
}
root.applyPostDiscoveryFilters(discoveryRequest);
root.prune();
return root;
}
use of org.junit.platform.launcher.Launcher in project spock by spockframework.
the class SpockHelloWorldTest method verifyErrorExample.
@Test
void verifyErrorExample() {
Launcher launcher = LauncherFactory.create(LauncherConfig.builder().enableTestEngineAutoRegistration(false).enableTestExecutionListenerAutoRegistration(false).addTestEngines(new SpockEngine()).build());
TestPlan testPlan = launcher.discover(LauncherDiscoveryRequestBuilder.request().selectors(selectClass(ErrorTestCase.class)).build());
assertEquals(1, testPlan.getChildren(testPlan.getRoots().iterator().next()).size());
execute(selectClass(StepwiseTestCase.class), stats -> stats.started(4).succeeded(3).failed(1).skipped(1));
}
use of org.junit.platform.launcher.Launcher in project spring-boot by spring-projects.
the class WebMvcTestPrintDefaultIntegrationTests method executeTests.
private void executeTests(Class<?> testClass) {
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request().selectors(DiscoverySelectors.selectClass(testClass)).build();
Launcher launcher = LauncherFactory.create();
launcher.execute(request);
}
use of org.junit.platform.launcher.Launcher in project spring-boot by spring-projects.
the class ImportsContextCustomizerFactoryWithAutoConfigurationTests method executeTests.
private void executeTests(Class<?> testClass) {
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request().selectors(DiscoverySelectors.selectClass(testClass)).build();
Launcher launcher = LauncherFactory.create();
launcher.execute(request);
}
use of org.junit.platform.launcher.Launcher in project neo4j by neo4j.
the class TestDirectoryExtensionTestSupport method execute.
private static void execute(LauncherDiscoveryRequest discoveryRequest, TestExecutionListener... testExecutionListeners) {
Launcher launcher = LauncherFactory.create();
launcher.execute(discoveryRequest, testExecutionListeners);
}
Aggregations