Search in sources :

Example 56 with TestDescriptor

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

the class FeatureResolverTest method scenario.

@Test
void scenario() {
    TestDescriptor scenario = getScenario();
    assertEquals("A scenario", scenario.getDisplayName());
    assertEquals(asSet(create("FeatureTag"), create("ScenarioTag"), create("ResourceA"), create("ResourceAReadOnly")), scenario.getTags());
    assertEquals(of(from(featurePath, from(5, 3))), scenario.getSource());
    assertEquals(TEST, scenario.getType());
    assertEquals(id.append("feature", featureSegmentValue).append("scenario", "5"), scenario.getUniqueId());
    PickleDescriptor pickleDescriptor = (PickleDescriptor) scenario;
    assertEquals(Optional.of("io.cucumber.junit.platform.engine"), pickleDescriptor.getPackage());
}
Also used : TestDescriptor(org.junit.platform.engine.TestDescriptor) Test(org.junit.jupiter.api.Test)

Example 57 with TestDescriptor

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

the class FeatureResolverTest method feature.

@Test
void feature() {
    TestDescriptor feature = getFeature();
    assertEquals("A feature with scenario outlines", feature.getDisplayName());
    assertEquals(emptySet(), feature.getTags());
    assertEquals(of(from(featurePath)), feature.getSource());
    assertEquals(CONTAINER, feature.getType());
    assertEquals(id.append("feature", featureSegmentValue), feature.getUniqueId());
}
Also used : TestDescriptor(org.junit.platform.engine.TestDescriptor) Test(org.junit.jupiter.api.Test)

Example 58 with TestDescriptor

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

the class FeatureResolverTest method longNames.

@Test
void longNames() {
    configurationParameters = new MapConfigurationParameters(JUNIT_PLATFORM_NAMING_STRATEGY_PROPERTY_NAME, "long");
    TestDescriptor example = getExample();
    assertEquals("A feature with scenario outlines - A scenario outline - With some text - Example #1", example.getDisplayName());
}
Also used : TestDescriptor(org.junit.platform.engine.TestDescriptor) Test(org.junit.jupiter.api.Test)

Example 59 with TestDescriptor

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

the class CucumberTestEngineTest method createExecutionContext.

@Test
void createExecutionContext() {
    EngineExecutionListener listener = new EmptyEngineExecutionListener();
    ConfigurationParameters configuration = new EmptyConfigurationParameters();
    EngineDiscoveryRequest discoveryRequest = new EmptyEngineDiscoveryRequest(configuration);
    UniqueId id = UniqueId.forEngine(engine.getId());
    TestDescriptor testDescriptor = engine.discover(discoveryRequest, id);
    ExecutionRequest execution = new ExecutionRequest(testDescriptor, listener, configuration);
    assertNotNull(engine.createExecutionContext(execution));
}
Also used : UniqueId(org.junit.platform.engine.UniqueId) EngineExecutionListener(org.junit.platform.engine.EngineExecutionListener) ExecutionRequest(org.junit.platform.engine.ExecutionRequest) ConfigurationParameters(org.junit.platform.engine.ConfigurationParameters) EngineDiscoveryRequest(org.junit.platform.engine.EngineDiscoveryRequest) TestDescriptor(org.junit.platform.engine.TestDescriptor) Test(org.junit.jupiter.api.Test)

Example 60 with TestDescriptor

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

the class DiscoverySelectorResolverTest method resolveRequestWithClasspathResourceSelectorAndFilePosition.

@Test
void resolveRequestWithClasspathResourceSelectorAndFilePosition() {
    String feature = "io/cucumber/junit/platform/engine/rule.feature";
    FilePosition line = FilePosition.from(5);
    DiscoverySelector resource = selectClasspathResource(feature, line);
    EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
    resolver.resolveSelectors(discoveryRequest, testDescriptor);
    assertEquals(1L, testDescriptor.getDescendants().stream().filter(TestDescriptor::isTest).count());
}
Also used : FilePosition(org.junit.platform.engine.discovery.FilePosition) DiscoverySelector(org.junit.platform.engine.DiscoverySelector) EngineDiscoveryRequest(org.junit.platform.engine.EngineDiscoveryRequest) TestDescriptor(org.junit.platform.engine.TestDescriptor) Test(org.junit.jupiter.api.Test)

Aggregations

TestDescriptor (org.junit.platform.engine.TestDescriptor)120 Test (org.junit.jupiter.api.Test)96 LauncherDiscoveryRequest (org.junit.platform.launcher.LauncherDiscoveryRequest)54 PlainOldJavaClassWithoutAnyTest (org.junit.vintage.engine.samples.PlainOldJavaClassWithoutAnyTest)31 UniqueId (org.junit.platform.engine.UniqueId)22 TestPlan (org.junit.platform.launcher.TestPlan)14 EngineDiscoveryRequest (org.junit.platform.engine.EngineDiscoveryRequest)12 ExecutionRequest (org.junit.platform.engine.ExecutionRequest)10 Optional (java.util.Optional)9 DemoHierarchicalTestDescriptor (org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestDescriptor)9 TestIdentifier (org.junit.platform.launcher.TestIdentifier)9 PlainJUnit4TestCaseWithFiveTestMethods (org.junit.vintage.engine.samples.junit4.PlainJUnit4TestCaseWithFiveTestMethods)9 ArrayList (java.util.ArrayList)8 Set (java.util.Set)8 ClassTestDescriptor (org.junit.jupiter.engine.descriptor.ClassTestDescriptor)8 DiscoverySelectors.selectUniqueId (org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId)8 ExecutionEventRecorder (org.junit.platform.engine.test.event.ExecutionEventRecorder)8 PlainJUnit4TestCaseWithSingleTestWhichFails (org.junit.vintage.engine.samples.junit4.PlainJUnit4TestCaseWithSingleTestWhichFails)8 List (java.util.List)7 DynamicTest (org.junit.jupiter.api.DynamicTest)7