/
Behavior-Driven Development (BDD)/Gherkin Cases

Behavior-Driven Development (BDD)/Gherkin Cases

AIO Tests allows you to use BDD/Gherkin as a means to define the test cases. By creating BDD/Gherkin cases on AIO Tests, you can not only make the test cases easy to review for managers and other non-programmers, but can also improve collaboration between key stakeholders on the project.

In this documentation, you’ll understand:

Steps to Create a BDD Case

Step 1: To create a BDD Case, simply click on the BDD/Gherkin tab.  

The action to create a BDD/Gherkin case is available at the time of case creation (Steps page) and also while editing a case (Steps tab). The image below is of the Steps tab opened in Edit mode.

Group 1 (14)-20240618-080839.png

Step 2: Click on the Add a Step button. 

Group 1 (12)-20240822-105229.png

Step 3: Create a scenario by selecting the keyword from the drop-down list, entering the description (action), and expected results.

  • Users have the option to choose the keywords- Given, When, Then, And, But, and *. 

    • Given- It is used to set up the context where the scenario happens (Establish context).

    • When- It is used to interact with the system (Perform Action).

    • Then- It is used to check the outcome of the interaction (What we expect).

    • And, But and *- It is used to add more steps to the scenario’s Given, When, or Then section.

  • Already added BDD steps start appearing in the description drop-down as text is being entered helping users choose previously written descriptions and reduce case writing time.

  • Users can add a new step by clicking on the plus icon (+), hitting the TAB key or pressing enter after entering the step description/data.

  • Users can delete a particular step by clicking on the Delete button. The step isn’t deleted permanently but is marked for deletion. The actual deletion takes place with the click of Save/Save & Close.

  • Users can also reorder the steps by using the reorder handle on the left.

Step 4: Finally, click on the Save button.

Group 1 (11)-20240822-104620.png

Steps to Create a Scenario Outline with Examples

Step 1: To create a scenario outline, all you need to do is click on the Edit button. 

The action to create a scenario outline is available at the time of case creation (Steps page) and also while editing a case (Steps tab). The image below is of the Steps tab opened in Edit mode.

Group 1 (13)-20240822-110510.png

Step 2: Click on the Examples button.

Group 1 (14)-20240822-110715.png

Step 3: Click on the plus sign (+) to add the parameter names. Enter the parameter name into the New parameter name field and click on the Add button.

  • For the Parameter name, you can only enter a maximum 50-character.

  • Users can also add predefined parameters by simply selecting the parameter from the dropdown list. To learn how to add predefined parameter, click here.

Step 4: Enter the values of the parameters. 

  • Users can add the new value of the parameter by clicking on the plus sign (+). 

  • Users can also delete the parameter value by clicking on the Delete button. 

  • Users can use parameters in steps by encapsulating angular brackets <>, similar to the Gherkin steps.

  • Users can choose the datasets from the parameter values for that particular predefined parameter. To learn more about predefined parameters, click here.

Step 5: Finally, click on the Save button.

Group 1 (15)-20240822-111424.png

Steps to Create a BDD Case By Pasting Scenario

Step 1: To create a BDD case, simply click on the Create option in the top bar menu and select Case from the drop-down list. 

Step 2: Click on the Create from Scenario button.

Group 1 (1)-20240722-064147.png

Step 3: Once you click on the Create from Scenario button, the Create from scenario modal window will appear on the screen where you need to paste your scenario.

image-20240722-071748.png

Step 4: Click on the Convert button.

Group 1 (2)-20240722-071844.png

Step 5: Once you click on the Convert button, all the details will automatically entered in the respective field in the Create Case screen. Click on the Add Steps button to view the steps.

Group 1 (3)-20240722-072733.png

Step 6: Finally, click on the Save & Close button.

Group 1 (4)-20240722-073508.png

Scenario with Examples (Datasets)

Steps to Change a Classic Case to BDD

Step 1: To change a classic case to BDD, you need to click on the Edit button on the Steps page. 

Group 1 (21)-20240618-085624.png

Step 2: Click on the Delete all steps button. 

Group 1 (22)-20240618-085817.png

Step 3: Click on the Save button. 

Users can only delete the steps permanently when they hit the Save button.

Group 1 (23)-20240618-085959.png

Step 4: Click on the BDD/Gherkin tab to add steps. 

  • If users want to change the BDD/Gherkin case to classic, they need to delete the steps written in the BDD/Gherkin tab. 

  • A classic case cannot be changed to a BDD case if it has been linked to another case.

  • If the link is removed, then the change from classic to BDD and vice-versa can happen.

  • A BDD case cannot be linked to a classic case.

Group 1 (24)-20240618-090125.png

Steps to Copy Steps from Other Cases

Step 1: To copy steps from other cases, all you need to do is click on the Vertical ellipsis button for the step after which you want to add steps from other cases. 

The action to copy steps from other cases is available at the time of case creation (Steps page) and also while editing a case (Steps tab). The GIF below is of the Steps tab opened in Edit mode.

Step 2: Click on the Copy Steps from Other Cases button.

Group 1 (16)-20240822-113551.png

Step 3: Once you click on the Copy Steps from Other Cases button, a modal window will appear on the screen where you can select a case to copy its steps. Click on the Select a case to copy its steps field and select a test case from the drop-down list from which you want to copy steps.  

  • Users can also have the option to add and apply filters to narrow down the search. 

  • Users can change the project through the project drop-down.

  • Users can use the search box to search for cases within the applied filter.

Step 4: Once you select the case, it will be displayed on the screen along with its steps from where you can select the step(s) to copy to a case by simply clicking on the checkbox. 

If the user wants to remove a case from the test cases list, they can do it by simply clicking on the Delete button.

Step 5: Click on the Copy button located at the top right corner of the screen to copy the selected steps to the target case.

  • The order of the copied steps will be the same in the target case as in the source case.

  • The serial number of all the steps in the target case will be recalculated to accommodate the addition of new steps.

  • The copied steps will appear immediately after the step against which the copy steps icon was clicked.

Group 1 (18)-20240822-114209.png

Once you click on the Copy button, the steps that you selected will be displayed on the Steps tab.

How to Duplicate Steps

Step 1: To duplicate steps, click on the Vertical ellipsis button for the step that you want to duplicate. 

  • The action to duplicate steps is available at the time of case creation (Steps page) and also while editing a case (Steps tab). The GIF below is of the Steps tab opened in Edit mode.

  • Users can also duplicate a step by clicking Ctrl/Cmd + D when they are in any of the boxes of the step.

Step 2: Click on the Duplicate Step button.

Group 1-20240619-052927.png

Once you click on the Duplicate Step button, the step will be automatically duplicated.

image-20240619-053022.png

Importing Existing Automated Cucumber Cases

Cases can be directly created in AIO Tests if you have existing cucumber automation via the Import Results option in the Cycles tab or via AIO Tests public REST APIs.

Click here for more information regarding Cucumber integration.

 

For further queries and suggestions, feel free to reach out to our customer support via help@aiotests.com

 

Related content