use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithClassSelectorShouldLogWarnIfNoFeaturesFound.
@Test
void resolveRequestWithClassSelectorShouldLogWarnIfNoFeaturesFound() {
DiscoverySelector resource = selectClass(NoFeatures.class);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertEquals(0, testDescriptor.getChildren().size());
assertEquals(1, logRecordListener.getLogRecords().size());
LogRecord logRecord = logRecordListener.getLogRecords().get(0);
assertEquals(Level.WARNING, logRecord.getLevel());
assertEquals("No features found in package 'io.cucumber.junit.platform.engine.nofeatures'", logRecord.getMessage());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithFileSelectorAndPosition.
@Test
void resolveRequestWithFileSelectorAndPosition() {
String feature = "src/test/resources/io/cucumber/junit/platform/engine/rule.feature";
FilePosition line = FilePosition.from(5);
DiscoverySelector resource = selectFile(feature, line);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertEquals(1L, testDescriptor.getDescendants().stream().filter(TestDescriptor::isTest).count());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithClasspathResourceSelectorAndFilePositionOfContainer.
@Test
void resolveRequestWithClasspathResourceSelectorAndFilePositionOfContainer() {
String feature = "io/cucumber/junit/platform/engine/rule.feature";
FilePosition line = FilePosition.from(3);
DiscoverySelector resource = selectClasspathResource(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 ignoreRequestWithUniqueIdSelectorFromDifferentEngine.
@Test
void ignoreRequestWithUniqueIdSelectorFromDifferentEngine() {
DiscoverySelector selector = selectUniqueId(UniqueId.forEngine("not-cucumber"));
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(selector);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertTrue(testDescriptor.getDescendants().isEmpty());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithUniqueIdSelectorFromJarUri.
@Test
void resolveRequestWithUniqueIdSelectorFromJarUri() {
String root = Paths.get("").toAbsolutePath().toUri().getSchemeSpecificPart();
URI uri = URI.create("jar:file:" + root + "/src/test/resources/feature.jar!/single.feature");
DiscoverySelector resource = selectUri(uri);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertEquals(1, testDescriptor.getChildren().size());
}
Aggregations