Search in sources :

Example 31 with TestDescriptor

use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.

the class VintageDiscovererTests method doesNotResolve.

private void doesNotResolve(LogRecordListener listener, Class<?> testClass) {
    LauncherDiscoveryRequest request = request().selectors(selectClass(testClass)).build();
    VintageDiscoverer discoverer = new VintageDiscoverer();
    TestDescriptor testDescriptor = discoverer.discover(request, engineId());
    assertThat(testDescriptor.getChildren()).isEmpty();
    assertThat(listener.stream(VintageDiscoverer.class)).isEmpty();
}
Also used : LauncherDiscoveryRequest(org.junit.platform.launcher.LauncherDiscoveryRequest) TestDescriptor(org.junit.platform.engine.TestDescriptor)

Example 32 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 33 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 34 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 35 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)

Aggregations

TestDescriptor (org.junit.platform.engine.TestDescriptor)143 Test (org.junit.jupiter.api.Test)103 LauncherDiscoveryRequest (org.junit.platform.launcher.LauncherDiscoveryRequest)58 UniqueId (org.junit.platform.engine.UniqueId)33 PlainOldJavaClassWithoutAnyTest (org.junit.vintage.engine.samples.PlainOldJavaClassWithoutAnyTest)31 ClassTestDescriptor (org.junit.jupiter.engine.descriptor.ClassTestDescriptor)19 TestMethodTestDescriptor (org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor)17 DiscoverySelectors.selectUniqueId (org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId)14 TestTemplateInvocationTestDescriptor (org.junit.jupiter.engine.descriptor.TestTemplateInvocationTestDescriptor)12 ArrayList (java.util.ArrayList)11 List (java.util.List)11 Set (java.util.Set)11 DynamicTest (org.junit.jupiter.api.DynamicTest)11 NestedClassTestDescriptor (org.junit.jupiter.engine.descriptor.NestedClassTestDescriptor)11 AbstractTestDescriptor (org.junit.platform.engine.support.descriptor.AbstractTestDescriptor)11 Optional (java.util.Optional)10 ExecutionRequest (org.junit.platform.engine.ExecutionRequest)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 EngineDiscoveryRequest (org.junit.platform.engine.EngineDiscoveryRequest)9 DemoHierarchicalTestEngine (org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine)9