Conceive a BDD test case script
BDD test cases are distinct from classic test cases by the structure of their test steps at the Test Step anchor . They are based on the Gherkin syntax and consist of a keyword followed by an action:
- Keyword: Given that, When, Then, And, But
- Action: Action phrase that follows the keyword.
Test steps of a BDD test case
Create a BDD test step
To create a BDD test case test step select a keyword from the dropdown list, enter an action in the text field and press the [Enter] button on the keyboard.
The 'Action' field of a BDD test case consists of one or more fixed parts (text) and one or more variables (parameters). An action must contain at least one fixed part and cannot be longer than 255 characters.
For the fixed parts of an action, all characters are allowed except <, > and " which are interpreted as parameter markers, and numbers which are automatically interpreted as variables. However, <, > and " characters can be escaped by a \ . \ can be escaped itself.
For the variable parts of an action, the characters allowed depend on the type of variable.
Once a BDD test step is added :
- either a new action is created in the current project
- or else the test step action is attached to an existing action in the current project or in one of the projects to which the user is empowered
The management of BDD test step actions is made through the Actions workspace carried by the Actionword Workspace plugin. This plugin also provides the user with a suggestion of the actions available in the library when entering/modifying BDD test steps.
If the 'Actionword Workspace' plugin is installed, the actions created, the test cases to which they are attached and information about their implementation can be viewed directly from the Actions workspace.
For more information, please visit the page Conceive Automated Tests
Modify and delete a BDD test step
The BDD test steps are modified by clicking directly on the test step fields. It is possible to modify the keyword and the action, the fixed parts and the variable parts. If the Actionword Workspace plugin is installed, when modifying an action, a list of suggested existing actions is displayed.
When an action is modified, either a new action is created or a link is established to an existing action.
Deleting a BDD test step does not suppress the action, it simply removes the link between the action and the test case. The action will still be present in the "Action words" Workspace.
Editing the additional data of a BDD test step
Each BDD test step contains a sub-menu where additional data can be entered.
These fields allow you to extend the action with additional information.
- The datatable field is used to add a table of values to the action. The values in the table must be filled in according to the formalism of the example provided at the time of the adding.
- The docstring field is used to add a multiline text to the action, which will be interpreted as an attribute of the action during automated execution.
- The comment field allows you to add one or more lines of comments to the action.
A test step cannot contain both a datatable and a docstring.
Generating the script preview of a BDD test case
A button [Preview] allows you to view the script that will be generated by Squash TM when exporting or transmitting the BDD test case.
The structure of the script displayed in the preview depends on the technology and the implementation language set up in the project configuration. For the same BDD test case, the script will therefore not be the same depending on the technology selected: Cucumber or Robot Framework.