In this tutorial, we will create some tests in Cucumber for Perl.
The test (specification) is initially created in Jira as a Cucumber Test and afterwards, it is exported using the UI or the REST API.
- Install the Test::BDD::Cucumber module
- Clone of the Github repository "test-bdd-cucumber-perl"
We will use the code from the Github repository "test-bdd-cucumber-perl" with slight changes.
The first step is to create two Cucumber Tests, one "Scenario" and one "Scenario Outline", in Jira. The specification would be similar to the calculator example provided in the Github repository.
After creating the Tests in Jira and associating them with the requirements, etc., you can export the specifications of the test to a Cucumber .feature file via the REST API or the Export to Cucumber UI action from within the Test Execution issue.
The created file will be similar to the original, but will contain the references to the Test issue key and the covered requirement issue key.
With the code below, you'll create a simple feature file. Note that we intentionally introduced a bug in the Scenario Outline specification (i.e., "6/3=3").
Please check if the Scenario Outline is specified using the "Scenario Outline" keywords.
The steps are implemented in Perl code.
After running the tests and generating the Cucumber JSON report (e.g., data.json), it can be imported to Xray via the REST API or the Import Execution Results action within the Test Execution.
The execution screen details will provide information on the test run result.
The Cucumber Scenarios Example/Result details (i.e., Hooks, Backgrounds and Steps) are only available for executions done in Xray v2.2.0 and above.
For a Cucumber Scenario Test:
For a Cucumber Scenario Outline Test:
The iconrepresents the evidences ("embeddings") for each Hook, Background and Step.
Please see Testing in BDD with Gherkin based frameworks (e.g. Cucumber) for an overview on how to use Cucumber Tests with Xray.
- Automated Tests (Import/Export)
- Exporting Cucumber Tests - REST