This topic explains how to integrate Jtest with Cucumber.

About Cucumber

Cucumber is a tool that reads executable specifications written in a natural language, such as English or Japanese. Test scenarios are described in plain text files with the .feature extension.

Integrating with Cucumber allows Jtest to report results and collect coverage data for Cucumber tests.

Supported Versions

Jtest supports Cucumber versions 4-6.

Integrating Jtest with Cucumber

Jtest ships with several Cucumber listeners – one listener per each supported Cucumber version.

To integrate Jtest with Cucumber, modify your Maven or Gradle command line by configuring the -Djtest.enableCucumber=true option. As a result, Jtest will automatically recognize the Cucumber version you are using and enable the Cucumber listener that matches that version. Example:

mvn clean compile test-compile jtest:agent test -Djtest.enableCucumber=true jtest:jtest -Djtest.config="builtin://Unit Tests"

Alternatively, you can manually specify the Cucumber listener that matches your Cucumber version:

  • Cucumber 4:

    -Dcucumber.options="--plugin com.parasoft.jtest.cucumber.CucumberListener4"
  • Cucumber 5 and higher:

    -Dcucumber.plugin="com.parasoft.jtest.cucumber.CucumberListener<version>"

Associating Cucumber Tests with Development Artifacts

You can associate Cucumber tests with development artifacts by using the @Tag<issue tracking tag> syntax. For example

@Tag("REQ:123")
@Tag(PR:123)
Scenario: Opening the library
  When it's 8:00 a.m.
  Then open the library

See Associating Tests with Development Artifacts for information how to enable artifact associations and a list of supported issue tracking tags.

  • No labels