Importing Cucumber Tests
The following endpoint is provided to import a Cucumber .feature file or a zip file containing multiple .feature files. The files in the zip file may be in folders/subfolders.
Cucumber ".feature" file | /rest/raven/1.0/import/feature |
Each .feature file will be processed as follows.
Tests:
- try to find the Test by key (in that project), if found then update it; else...
- try to find the Test having both
- a label with the original relative path of .feature (e.g. "core/sample_addition.feature)
- a label named "id:xxx", where xxx is some number (e.g. "id:1", "id:32"); this label comes from a scenario/scenario outline's tag
- try to find the Test having both
- a label with the original relative path of .feature (e.g. "core/sample_addition.feature)
- the same summary
- try to find the Test by summary (in that project), if found then update it; else...
- create Test in that project and add a label with the relative path of the feature, and another label corresponding to a tag "id:xxx" (if it exists)
Pre-Conditions:
- try to find the Pre-Condition by key (in that project), if found then update it; else...
- try to find the Pre-Condition having both
- a label with the original relative path of .feature (e.g. "core/sample_addition.feature)
- try to find the Pre-Condition by summary (in that project), if found then update it; else...
- create Pre-Condition in that project and add a label with the relative path of the feature
The mapping from the Scenario/Scenario Outline present in the .feature files to the Test issues in Jira would be as follows:
Scenario/Scenario Outline | Test in JIRA |
---|---|
name of the Scenario/Scenario Outline | "Summary" field |
steps | "Scenario" field |
tags of the Scenario/Scenario Outline | labels |
The "Feature" section is not imported since the feature itself should exist previously as a Jira requirement issue (e.g., story).
The exception is the tags before the "Feature: " section; if a requirement issue is found for the specified key, then a "Tests" link is created between the Test and the requirement issue.
If the Cucumber feature has a background, a Pre-Condition issue will be created, if the issue key in the tag does not exist in JIRA, or updated, containing the information provided in that background.
If the background has no name, then the Summary of the Pre-Condition is going to be a string containing the keys of the Tests of that Cucumber feature (e.g. "Background for: CALC-1, CALC-2").
Below is an example of a .feature file containing a Scenario Outline and two Pre Conditions:
@REQ_CALC-889 Feature: As a user, I can calculate the sum of 2 numbers Background: #@PRECOND_TX-114 Given that the calculator is configurated Then turn on the calculator And set the mode to advanced #@PRECOND_TX-115 Given that the calculator is configurated Turn on the basic mode @UI @core Scenario Outline: Cucumber Test As a user, I can calculate the sum of 2 numbers Given I have entered <input_1> into the calculator And I have entered <input_2> into the calculator When I press <button> Then the result should be <output> on the screen Examples: | input_1 | input_2 | button | output | | 20 | 30 | add | 50 | | 2 | 5 | add | 7 | | 0 | 40 | add | 40 | | 4 | 50 | add | 54 |
In this other example, more typical
@REQ_CALC-1910 Feature: As a user, I can calculate the sum of two numbers Background: Given I have a calculator And I have some fingers @id:1 @fast Scenario Outline: Cucumber Test As a user, I can calculate the sum of two positive numbers Given I have entered <input_1> into the calculator And I have entered <input_2> into the calculator When I press <button> Then the result should be <output> on the screen Examples: | input_1 | input_2 | button| output| | 20 | 30 | add | 50 | | 2 | 5 | add | 7 | | 0 | 40 | add | 40 | | 4 | 50 | add | 54 | | 5 | 50 | add | 55 |