Skip to content

Automation with Cucumber

Compatibility with Cucumber 5 or greater

If your project uses a Cucumber version older than 5, select the Cucumber 4 technology. Otherwise, if it uses Cucumber 5 or posterior, select the Cucumber 5+ technology.

Test reference in Squash TM

Depending on the report test precision you wish to apply to your test case, you can refine it down to a feature (in the case your .feature file contains more than one feature, which is not recommended even though Cucumber allows it) or to a specific scenario.

In order to bind a Squash TM test case to a Cucumber automated test, the content of the Automated test reference field of the Automation block of a test case must have the following format:

[1] / [2] # [3] # [4]

With:

  • [1]: Name of the project on the source code repository.

  • [2]: Path and name of the Cucumber test file, from the root of the project (with the .feature extension).

  • [3]: feature name as specified in the Cucumber test file. This parameter is optional.

  • [4]: scenario name as specified in the Cucumber test file. This parameter is optional.

Example: MyRepo/path/to/my/test.feature#My feature name#My scenario name

Automated test reference and execution

The feature [3] and scenario [4] precisions in the test reference have no impact on the execution, but only on the test result determination.
So, even when defining the specific level of the feature or scenario, all tests defined in the .feature file will be executed (this means, for example, that if several Squash TM test cases point toward the same file but with different features or scenarios, then all the file tests will be executed several times).
The test reports include the traces of all executed tests. But, only the Error / Failed / Success statuses corresponding to the specific feature or scenario are used to determinate the test case result.

Info

If a scenario name is not specified, the result of each executed Squash TM test case is calculated by taking into account the individual results of each scenario included in the bound file:

  • If at least one scenario has an Error status (in case of a technical issue), the status of the execution will be Blocked.

  • If at least one scenario fails functionally and none of the other has an Error status, the status of the execution will be Failed.

  • If all scenarios succeed, the status of the execution will be Success.

Nature of the exploitable Squash TM parameters

Squash AUTOM and Squash DEVOPS are able to use the name of a Squash TM dataset as a tag value to use for the execution of a specific subset of a Cucumber feature.

Both Community and Premium versions can use dataset names.

Squash TM parameters usage

When executing a Squash TM automated test case with Cucumber, it is possible to exploit the Squash TM dataset name in order to execute a specific dataset of a Cucumber scenario.

In order to achieve this, you'll have to follow these steps:

  • Fill the datasets in the Parameters tab of the test case in Squash TM.

  • Create in a Cucumber scenario as many example table as there are dataset in Squash TM test case. Annotate them with a tag corresponding to the name of a Squash TM dataset.

  • Create one line of elements in each example table to set scenario's parameters values for the dataset.

Below is an example of a Cucumber test file and the corresponding Squash TM test case automation:

cucumber-tags-1

cucumber-tags-2

cucumber-tags-3

cucumber-tags-1

cucumber-tags-2

cucumber-tags-3

Generation of Allure reports with the cucumber/cucumber@v1 and cucumber5/cucumber@v1 actions

When using the cucumber/cucumber@v1 and cucumber5/cucumber@v1 actions (see the orchestrator documentation) via the piloting with a PEaC, if you want the Cucumber test results to appear in the Allure report generated for the PEaC, you need to use the JUnit reporter (possibly with other reporters).

Supported versions

Squash AUTOM and Squash DEVOPS have been validated with Cucumber-JVM 4.2.6, 5.7.0, 6.11.0, and 7.0.0. Any recent version should work properly.

Back to top