All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.cucumber.junit.platform.engine.CucumberTestEngine Maven / Gradle / Ivy

There is a newer version: 7.20.1
Show newest version
package io.cucumber.junit.platform.engine;

import org.apiguardian.api.API;
import org.junit.platform.engine.ConfigurationParameters;
import org.junit.platform.engine.EngineDiscoveryRequest;
import org.junit.platform.engine.ExecutionRequest;
import org.junit.platform.engine.TestDescriptor;
import org.junit.platform.engine.UniqueId;
import org.junit.platform.engine.support.config.PrefixedConfigurationParameters;
import org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService;
import org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine;
import org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService;

import static io.cucumber.junit.platform.engine.Constants.PARALLEL_CONFIG_PREFIX;
import static io.cucumber.junit.platform.engine.Constants.PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME;

/**
 * The Cucumber {@link org.junit.platform.engine.TestEngine TestEngine}.
 * 

* Supports discovery and execution of {@code .feature} files using the * following selectors: *

    *
  • {@link org.junit.platform.engine.discovery.ClasspathRootSelector}
  • *
  • {@link org.junit.platform.engine.discovery.ClasspathResourceSelector}
  • *
  • {@link org.junit.platform.engine.discovery.PackageSelector}
  • *
  • {@link org.junit.platform.engine.discovery.FileSelector}
  • *
  • {@link org.junit.platform.engine.discovery.DirectorySelector}
  • *
  • {@link org.junit.platform.engine.discovery.UniqueIdSelector}
  • *
  • {@link org.junit.platform.engine.discovery.UriSelector}
  • *
*/ @API(status = API.Status.STABLE) public final class CucumberTestEngine extends HierarchicalTestEngine { @Override public String getId() { return "cucumber"; } @Override public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) { CucumberEngineDescriptor engineDescriptor = new CucumberEngineDescriptor(uniqueId); new DiscoverySelectorResolver().resolveSelectors(discoveryRequest, engineDescriptor); return engineDescriptor; } @Override protected HierarchicalTestExecutorService createExecutorService(ExecutionRequest request) { ConfigurationParameters config = request.getConfigurationParameters(); if (config.getBoolean(PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME).orElse(false)) { return new ForkJoinPoolHierarchicalTestExecutorService( new PrefixedConfigurationParameters(config, PARALLEL_CONFIG_PREFIX)); } return super.createExecutorService(request); } @Override protected CucumberEngineExecutionContext createExecutionContext(ExecutionRequest request) { return new CucumberEngineExecutionContext(request.getConfigurationParameters()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy