use of org.junit.platform.engine.DiscoverySelector in project gradle by gradle.
the class JUnitPlatformTestClassProcessor method createLauncherDiscoveryRequest.
private LauncherDiscoveryRequest createLauncherDiscoveryRequest(List<Class<?>> testClasses) {
List<DiscoverySelector> classSelectors = testClasses.stream().map(DiscoverySelectors::selectClass).collect(Collectors.toList());
LauncherDiscoveryRequestBuilder requestBuilder = LauncherDiscoveryRequestBuilder.request().selectors(classSelectors);
addTestNameFilters(requestBuilder);
addEnginesFilter(requestBuilder);
addTagsFilter(requestBuilder);
return requestBuilder.build();
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithUriSelectorWithExampleLine.
@Test
void resolveRequestWithUriSelectorWithExampleLine() {
File file = new File("src/test/resources/io/cucumber/junit/platform/engine/feature-with-outline.feature");
URI uri1 = URI.create(file.toURI() + "?line=20");
DiscoverySelector resource = selectUri(uri1);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
List<? extends TestDescriptor> tests = testDescriptor.getDescendants().stream().filter(TestDescriptor::isTest).collect(Collectors.toList());
assertEquals(1, tests.size());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithPackageSelector.
@Test
void resolveRequestWithPackageSelector() {
DiscoverySelector resource = selectPackage("io.cucumber.junit.platform.engine");
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertEquals(5, testDescriptor.getChildren().size());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithClasspathRootSelector.
@Test
void resolveRequestWithClasspathRootSelector() {
Path classpathRoot = Paths.get("src/test/resources/");
DiscoverySelector resource = selectClasspathRoots(singleton(classpathRoot)).get(0);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertEquals(6, testDescriptor.getChildren().size());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveFeatureTestDescriptorsInUriOrder.
@Test
void resolveFeatureTestDescriptorsInUriOrder() {
Path classpathRoot = Paths.get("src/test/resources/");
DiscoverySelector resource = selectClasspathRoots(singleton(classpathRoot)).get(0);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
Set<? extends TestDescriptor> features = testDescriptor.getChildren();
List<TestDescriptor> unsorted = new ArrayList<>(features);
List<TestDescriptor> sorted = new ArrayList<>(features);
// Sorts by URI
sorted.sort(comparing(feature -> feature.getUniqueId().getSegments().get(1).getValue()));
assertEquals(unsorted, sorted);
}
Aggregations