Class TestNGCucumberRunner

java.lang.Object
io.cucumber.testng.TestNGCucumberRunner

@Deprecated(forRemoval=true) @API(status=DEPRECATED) public final class TestNGCucumberRunner extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Since v3.6.0 Maven Surefire uses the JUnit Platform to run TestNG. Cucumber support the JUnit Platform directly. Since v9.4.0 Gradle supports resource based test on the JUnit Platform. This leaves little reason to support a dedicated TestNG runner.

Please switch to cucumber-junit-platform-engine. If there are missing features that prevent you from upgrading please create an issue.

Glue code for running Cucumber via TestNG.

Options can be provided in by (order of precedence):

  1. Properties from System.getProperties()
  2. Properties from in System.getenv()
  3. Properties properties from testng.xml
  4. Annotating the runner class with CucumberOptions
  5. Properties from "cucumber.properties"
For available properties see Constants.
  • Field Details

    • filters

      private final Predicate<Pickle> filters
      Deprecated, for removal: This API element is subject to removal in a future version.
    • features

      private final List<Feature> features
      Deprecated, for removal: This API element is subject to removal in a future version.
    • context

      private final CucumberExecutionContext context
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

    • TestNGCucumberRunner

      public TestNGCucumberRunner(Class<?> clazz)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Bootstrap the cucumber runtime
      Parameters:
      clazz - Which has the CucumberOptions and Test annotations
    • TestNGCucumberRunner

      @API(status=STABLE, since="6.11") public TestNGCucumberRunner(Class<?> clazz, CucumberPropertiesProvider properties)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Bootstrap the cucumber runtime
      Parameters:
      clazz - Which has the CucumberOptions and Test annotations
      properties - additional properties (e.g. from testng.xml).
  • Method Details

    • createRuntimeOptions

      private static RuntimeOptions createRuntimeOptions(Class<?> clazz, CucumberPropertiesProvider properties)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • createFeatureSupplier

      private static FeaturePathFeatureSupplier createFeatureSupplier(UuidGenerator idGenerator, Supplier<ClassLoader> classLoader, RuntimeOptions runtimeOptions)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • createIdGenerator

      private static UuidGenerator createIdGenerator(Supplier<ClassLoader> classLoader, RuntimeOptions runtimeOptions)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • createExecutionContext

      private CucumberExecutionContext createExecutionContext(Class<?> clazz, Supplier<ClassLoader> classLoader, RuntimeOptions runtimeOptions, EventBus bus, ExitStatus exitStatus)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • runScenario

      public void runScenario(Pickle pickle)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • finish

      public void finish()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finishes test execution by Cucumber.
    • provideScenarios

      public Object[][] provideScenarios()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Provides scenarios for execution.
      Returns:
      an array of pickle and feature wrapper pairs.
    • provideDryRunScenarios

      @API(status=EXPERIMENTAL, since="8.0.0") public static Object[][] provideDryRunScenarios(Class<?> clazz)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Provides scenarios for executing without initializing Cucumber. These scenarios can only be used when TestNG does a dry-run.

      For consistent results between dry-run and regular execution, this method should be used when the TestNGCucumberRunner is instantiated by TestNGCucumberRunner(java.lang.Class<?>).

      Parameters:
      clazz - Which has the CucumberOptions and Test annotations
      Returns:
      an array of pickle and feature wrapper pairs.
    • provideDryRunScenarios

      @API(status=EXPERIMENTAL, since="8.0.0") public static Object[][] provideDryRunScenarios(Class<?> clazz, CucumberPropertiesProvider properties)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Provides scenarios without initializing Cucumber. These scenarios can only be used when TestNG does a dry-run. p> For consistent results between dry-run and regular execution, this method should be used when the TestNGCucumberRunner is instantiated by TestNGCucumberRunner(java.lang.Class<?>,io.cucumber.testng.CucumberPropertiesProvider).
      Parameters:
      clazz - Which has the CucumberOptions and Test annotations
      Returns:
      an array of pickle and feature wrapper pairs.
    • provideScenarios

      private static Object[][] provideScenarios(List<Feature> features, Predicate<Pickle> filters, boolean dryrun)
      Deprecated, for removal: This API element is subject to removal in a future version.