BDD Tests
Note
Previously, BDD support in Zephyr Squad required installing an additional app, Cucumber for Jira. As of August 23, 2020 this is no longer needed.
Enable or disable BDD
BDD (behavior-driven development) support is enabled by default for all projects. If needed, you can disable or enable BDD for specific projects individually.
To enable or disable BDD for a specific project, navigate to Project settings > Zephyr - BDD/Cucumber and switch the toggle on or off:
Important
We recommend that you clear the cache after enabling the BDD feature. To do that, navigate to the Apps > General Configuration > Clear Cache section in Jira settings and click Clear Cache.
Create a BDD Feature
There are two methods to create a BDD feature.
Method 1
Click Zephyr Squad, then Create a BDD Feature in the menu on the left.
Select Story as the issue type.
Specify details and click Create.
Method 2
Click the Create at the top.
Select Story as the issue type.
Add the BDD_Feature label.
Specify details and click Create.
Create a BDD Background
Open a BDD Feature you created earlier.
Click Feature content:
Click Background and add steps, comments, and a description in the field below. Once done, click to save the specified text:
Note
To hide or show the background field, click the arrow button to the right of the scenario name. To hide or show all the feature content fields, click Collapse All or Expand All respectively.
How the BDD Background Feature works
For all the mentioned features, the background scenarios will be displayed within the Execute Test page once all tests have been added to any of the test cycles or folders.
For the scenario outline, the background scenarios will be displayed within the Execute Test page once all the tests have been added to any of the test cycles or folders.
Create BDD scenarios
Open a BDD Feature you created earlier.
Click Feature content.
Enter a scenario name in the Scenario field.
Click to create the scenario:
Note:Each time you create a scenario, Zephyr Squad creates an issue of the Test type and names it Test-XX, where XX is the scenario number.
Click Add steps and enter your scenario in the field:
Click to apply the changes.
Note
To hide or show the scenario field, click the arrow next to the scenario name. To hide or show all the feature content fields, click Collapse All or Expand All respectively.
Create BDD test scenarios
Open a BDD Feature you created earlier.
Click Feature content:
Enter a scenario name in the Scenario field and click .
Refresh the page and click the created scenario:
On the scenario page, click the Test Details to move to the Test Details section:
Enter the details in the Test Details section and click :
Note:Each time you create a scenario, Zephyr Squad creates an issue of the Test type and names it Test-XX, where XX is the scenario number.
Download the feature file from a story
You can download a feature file containing the Background, Scenarios, Tags, and Description of the BDD Feature. To do that:
Open a BDD Feature you created earlier.
Add a BDD background and create a scenario as described above.
Click Download feature file:
Import a feature file
You can import an existing feature file. In this case, the Background, Scenarios, and Tags of that file will be added to your BDD Feature, and the description specified in the imported feature file will overwrite the description of your BDD Feature.
Note
Rule
elements of feature files are not supported yet. Their background is skipped.
To import a feature file, do the following:
Open a BDD Feature you created earlier.
Click Feature content:
Click the upload button:
Important
If the button is disabled, make sure the Background and Scenario fields of the BDD Feature are empty.
Click Upload feature file and browse for the feature file to import:
After selecting the file, click Confirm.
Add a BDD test to a test cycle
Create a BDD Feature.
Add a BDD background and create a scenario as described above.
Navigate to the Zephyr Squad > Cycle Summary.
Create a test cycle and then add the feature as you add any other test case.
Download the feature file from the test cycle or folder
Create a BDD feature.
Add a BDD background and create a scenario as described above.
Navigate to the Cycle Summary page. Create a test cycle and then add the feature in a way you add any other test case.
Click the ellipses button next to the test cycle name, and then select Download Feature File from the drop-down menu:
This will download the feature file directly from the test cycle. The feature file will contain CycleId and/or FolderId. Hence, the results file for these feature files can be uploaded to any test cycle or folder.
Upload Cucumber results to a test cycle or folder
Create a BDD Feature.
Add a BDD background and scenario as described above.
Navigate to your Cycle Summary page. Create a test cycle and then add the feature in a way you add any other test case.
Click the ellipses button next to the test cycle name, and then select Download Feature File from the drop-down menu.
This will download the feature file directly from the test cycle/folder. The feature file will contain the CycleId and/or FolderId. Hence, the results file for these feature files can be uploaded to any test cycle or folder.
Generate the JSON results file using the downloaded feature file.
Click the ellipses button next to the test cycle name, and then select Upload Cucumber Results:
Select the file from the location where the file is located. The results will be updated as per the JSON file.
Add a scenario outline
Create a BDD Feature.
Go to the Feature content section and create a scenario.
Click the scenario you’ve just created.
On the scenario page, click the Test Details icon to move to the Test Details section.
Specify the following scenario:
Given user navigates to Zephyr When I enter Username as <username> and Password as <password> Then login should not be successful Examples: |username | password | |username1 | password 1 | |username2 | password 2 |
How the scenario outline works
If the same test case needs to be repeated with multiple inputs and parameters, then it should be enclosed in angle brackets (<
>
).
Then you need to provide multiple inputs and parameters for the scenario as shown above (excluding the extra white spaces).
The examples should be added before the inputs and parameters as shown:
Upload the JSON results file via Postman
Add a BDD Feature/Test to a test cycle and/or folder.
Download the feature file from the test cycle and/or folder.
Upload the results file generated from the feature file as show in the images below:
Notes
After uploading the results file, you may need to perform a browser refresh in order to see the results.
You can add tags to your BDD feature or scenario. To do that, click Add a tag, enter a name, and press Enter.
The downloaded feature file will contain the specified tags:
Behaviors
If you download the feature file from the test cycle, this will download only the scenarios that are present at the test cycle level.
For example, let’s say you have test cycle C1 and then you have two folders under it called F1 and F2. The test cycle C1 contains Test1, F1 contains Test2 and F2 contains Test3.
If we download the feature file from C1 → This will download the feature file with only the Test1 Scenario.
If we download the feature file from F1 → This will download the feature file with only the Test2 Scenario.
If we download the feature file from F2 → This will download the feature file with only the Test3 Scenario.
If you upload the results file at the test cycle level, it will only upload the results at the test cycle and folder level. If you are trying to upload and the cycle or folder id doesn’t match, then there will be an error that prevents you from uploading.
If you download the feature file from the view issue page, you can upload the results for this feature at any cycle or folder level.
When users download the feature file from the view issue page, then the user is able to upload the results to any test cycle and folder aside from the Ad-hoc cycle.
If a scenario is already present within that cycle or folder, then it will update the same test.
If the scenario is not present, then it will create a new test and update the results.
Step and results status behavioral changes
If all the test steps are passing, then the overall step result will be set to PASS.
If all the test steps are failing, then the overall step result will be set to FAIL.
Limitations
If you are using the older UI, only the feature can be created by not the scenarios.
Downloading and uploading results at the Ad-hoc test cycle is not supported.
Currently, we are only supporting Cucumber JSON format when you are uploading the results file.
API
Gherkin content of BDD Features and Scenarios is accessible via a REST API. You can use this API to get and set feature content and scenario content programmatically.