BDD Tests

Applies to Zephyr Squad Cloud, last modified on November 22, 2021

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 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:

Enabling BDD support

Click the image to enlarge it.

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

  1. Enable the BDD feature for a particular project.

  2. There are two methods to create a BDD feature:

    Method 1

    1. Click Zephyr Squad, then Create a BDD Feature in the menu on the left.

    2. Select Story as the issue type.

    3. Specify details and click Create.

    Method 2

    1. Click the Create at the top.

    2. Select Story as the issue type.

    3. Add the BDD_Feature label.

    4. Specify details and click Create.

Create a BDD Background

  1. Open a BDD Feature you created earlier.

  2. Click Feature content:

    Open Feature content

    Click the image to enlarge it.

  3. Click Background and add steps, comments, and a description in the field below. Once done, click to save the specified text:

    Creating a BDD Background

    Click the image to enlarge it.

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

  1. Open a BDD Feature you created earlier.

  2. Click Feature content.

    Open Feature content

    Click the image to enlarge it.

  3. Enter a scenario name in the Scenario field.

  4. Click to create the scenario:

    Creating a BDD scenario

    Click the image to enlarge it.

    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.

  5. Click Add steps and enter your scenario in the field:

    The created BDD scenario

    Click the image to enlarge it.

  6. 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

  1. Open a BDD Feature you created earlier.

  2. Click Feature content:

    Open Feature content

    Click the image to enlarge it.

  3. Enter a scenario name in the Scenario field and click .

  4. Refresh the page and click the created scenario:

    Open a BDD scenario

    Click the image to enlarge it.

  5. On the scenario page, click the Test Details to move to the Test Details section:

    Creating a BDD test scenario

    Click the image to enlarge it.

  6. Enter the details in the Test Details section and click :

    The created BDD test scenario

    Click the image to enlarge it.

    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:

  1. Open a BDD Feature you created earlier.

  2. Add a BDD background and create a scenario as described above.

  3. Click Download feature file:

    Downloading a feature file

    Click the image to enlarge it.

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:

  1. Open a BDD Feature you created earlier.

  2. Click Feature content:

    Open Feature content

    Click the image to enlarge it.

  3. Click the upload button:

    Import a feature file

    Click the image to enlarge it.

    If the button is disabled, make sure the Background and Scenario fields of the BDD Feature are empty.

  4. Click Upload feature file and browse for the feature file to import:

    Upload a feature file

    Click the image to enlarge it.

  5. After selecting the file, click Confirm.

Add a BDD test to a test cycle

  1. Create a BDD Feature.

  2. Add a BDD background and create a scenario as described above.

  3. Navigate to the Zephyr Squad > Cycle Summary.

  4. 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

  1. Create a BDD feature.

  2. Add a BDD background and create a scenario as described above.

  3. Navigate to the Cycle Summary page. Create a test cycle and then add the feature in a way you add any other test case.

  4. Click the ellipses button next to the test cycle name, and then select Download Feature File from the drop-down menu:

    Downloading feature files from a folder

    Click the image to enlarge it.

    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

  1. Create a BDD Feature.

  2. Add a BDD background and scenario as described above.

  3. Navigate to your Cycle Summary page. Create a test cycle and then add the feature in a way you add any other test case.

  4. 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.

  5. Generate the JSON results file using the downloaded feature file.

  6. Click the ellipses button next to the test cycle name, and then select Upload Cucumber Results:

    Uploading cucumber results to Zephyr

    Click the image to enlarge it.

    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

  1. Create a BDD Feature.

  2. Go to the Feature content section and create a scenario.

  3. Click the scenario you’ve just created.

  4. On the scenario page, click the Test Details icon to move to the Test Details section.

  5. 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:

BDD outline results

Click the image to enlarge it.

Upload the JSON results file via Postman

  1. Add a BDD Feature/Test to a test cycle and/or folder.

  2. Download the feature file from the test cycle and/or folder.

  3. Upload the results file generated from the feature file as show in the images below:

    Specifying Content-Type header

    Click the image to enlarge it.

    Uploading JSON results

    Click the image to enlarge it.

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.

    Tags

    Click the image to enlarge it.

    The downloaded feature file will contain the specified tags:

    Tags

    Click the image to enlarge it.

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.

See Also

UI Overview
Import Cucumber Test Results

Watch the video
Highlight search results