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 allowed.
Info
The management of BDD test step actions is done through the Action Word workspace (Squash Ultimate license 💎).
The created actions, the test cases they are linked to, as well as information about their implementation, are directly visible from this workspace.
Squash Ultimate license 💎 also offers users suggestions for actions available in the library when entering or modifying BDD test steps.
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. With Squash Ultimate license, 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 delete the action, it simply removes the link between the action and the test case. The action will still be present in the Action word 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 according to the formalism of the example provided while 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.
Info
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 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.