Search in sources :

Example 26 with DiscoverySelector

use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.

the class DiscoverySelectorResolverTest method resolveRequestWithFileSelector.

@Test
void resolveRequestWithFileSelector() {
    DiscoverySelector resource = selectFile("src/test/resources/io/cucumber/junit/platform/engine/single.feature");
    EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
    resolver.resolveSelectors(discoveryRequest, testDescriptor);
    assertEquals(1, testDescriptor.getChildren().size());
}
Also used : DiscoverySelector(org.junit.platform.engine.DiscoverySelector) EngineDiscoveryRequest(org.junit.platform.engine.EngineDiscoveryRequest) Test(org.junit.jupiter.api.Test)

Example 27 with DiscoverySelector

use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.

the class DiscoverySelectorResolverTest method resolveRequestWithMultipleUniqueIdSelector.

@Test
void resolveRequestWithMultipleUniqueIdSelector() {
    Set<UniqueId> selectors = new HashSet<>();
    DiscoverySelector resource = selectDirectory("src/test/resources/io/cucumber/junit/platform/engine/feature-with-outline.feature");
    selectSomePickle(resource).ifPresent(selectors::add);
    DiscoverySelector resource2 = selectDirectory("src/test/resources/io/cucumber/junit/platform/engine/single.feature");
    selectSomePickle(resource2).ifPresent(selectors::add);
    EngineDiscoveryRequest discoveryRequest = new SelectorRequest(selectors.stream().map(DiscoverySelectors::selectUniqueId).collect(Collectors.toList()));
    resolver.resolveSelectors(discoveryRequest, testDescriptor);
    assertEquals(selectors, testDescriptor.getDescendants().stream().filter(PickleDescriptor.class::isInstance).map(TestDescriptor::getUniqueId).collect(toSet()));
}
Also used : UniqueId(org.junit.platform.engine.UniqueId) DiscoverySelectors.selectUniqueId(org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId) DiscoverySelector(org.junit.platform.engine.DiscoverySelector) EngineDiscoveryRequest(org.junit.platform.engine.EngineDiscoveryRequest) TestDescriptor(org.junit.platform.engine.TestDescriptor) HashSet(java.util.HashSet) DiscoverySelectors(org.junit.platform.engine.discovery.DiscoverySelectors) Test(org.junit.jupiter.api.Test)

Aggregations

DiscoverySelector (org.junit.platform.engine.DiscoverySelector)27 Test (org.junit.jupiter.api.Test)23 EngineDiscoveryRequest (org.junit.platform.engine.EngineDiscoveryRequest)23 URI (java.net.URI)7 TestDescriptor (org.junit.platform.engine.TestDescriptor)6 File (java.io.File)5 DiscoverySelectors.selectFile (org.junit.platform.engine.discovery.DiscoverySelectors.selectFile)5 FilePosition (org.junit.platform.engine.discovery.FilePosition)5 ArrayList (java.util.ArrayList)3 Path (java.nio.file.Path)2 HashSet (java.util.HashSet)2 LogRecord (java.util.logging.LogRecord)2 UniqueId (org.junit.platform.engine.UniqueId)2 DiscoverySelectors (org.junit.platform.engine.discovery.DiscoverySelectors)2 DiscoverySelectors.selectUniqueId (org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId)2 LauncherDiscoveryRequestBuilder (org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder)2 LogRecordListener (io.cucumber.core.logging.LogRecordListener)1 LoggerFactory (io.cucumber.core.logging.LoggerFactory)1 NoFeatures (io.cucumber.junit.platform.engine.nofeatures.NoFeatures)1 BufferedReader (java.io.BufferedReader)1