use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithFileSelectorAndPositionOfContainer.
@Test
void resolveRequestWithFileSelectorAndPositionOfContainer() {
String feature = "src/test/resources/io/cucumber/junit/platform/engine/rule.feature";
FilePosition line = FilePosition.from(3);
DiscoverySelector resource = selectFile(feature, line);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertEquals(2L, testDescriptor.getDescendants().stream().filter(TestDescriptor::isTest).count());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithUniqueIdSelectorFromClasspath.
@Test
void resolveRequestWithUniqueIdSelectorFromClasspath() {
DiscoverySelector resource = selectPackage("io.cucumber.junit.platform.engine");
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
Set<? extends TestDescriptor> descendants = testDescriptor.getDescendants();
descendants.forEach(targetDescriptor -> {
resetTestDescriptor();
resolveRequestWithUniqueIdSelector(targetDescriptor.getUniqueId());
assertEquals(1, testDescriptor.getChildren().size());
assertThat(testDescriptor, allDescriptorsPrefixedBy(targetDescriptor.getUniqueId()));
});
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithDirectorySelector.
@Test
void resolveRequestWithDirectorySelector() {
DiscoverySelector resource = selectDirectory("src/test/resources/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 resolveRequestWithUriSelectorWithExamplesSectionLine.
@Test
void resolveRequestWithUriSelectorWithExamplesSectionLine() {
File file = new File("src/test/resources/io/cucumber/junit/platform/engine/feature-with-outline.feature");
URI uri = URI.create(file.toURI() + "?line=17");
DiscoverySelector resource = selectUri(uri);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
List<? extends TestDescriptor> tests = testDescriptor.getDescendants().stream().filter(TestDescriptor::isTest).collect(Collectors.toList());
// 2 examples in the examples section
assertEquals(2, tests.size());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithClassSelector.
@Test
void resolveRequestWithClassSelector() {
DiscoverySelector resource = selectClass(RunCucumberTest.class);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertEquals(5, testDescriptor.getChildren().size());
}
Aggregations