Conceive Automated Tests
Reminders on BDD Test Cases
BDD test cases are different from classic test cases due to the structure of their test steps. BDD test steps are based on Gherkin syntax. They contain two things:
- a Keyword: Given, When, Then, And, But;
- an Action: an action sentence following the keyword.
Info
It is possible to use Gherkin test cases to start automation but BDD test cases have more advanced features.
Action word Workspace
Info
The Action word workspace is accessible with Squash Ultimate license. 💎
The Action word workspace offers two main features:
- Manage actions used by BDD test cases;
- When writing BDD test steps, get suggestions of available actions in the projects on which you are authorized.
Every project has its own actions library. But one action can be used by test cases from different projects.
Learn more
It is possible to configure the action words case insensitivity. To learn more, visit the page Action words case insensitivity
Action consultation page
On an action's consultation page, there are four blocks:
- The "Information" block contains the project's name and the action's description;
- The "Parameter" block enables you to manage the action's parameters;
- The "Test cases using this action word" block enables you to view the information on the test cases that use the action. By clicking on the name of the test case, its consultation page appears;
- The Implementation block contains the information related to the action's implementation:
- The Technology column indicates which implementation technology is set up at the level of the Squash project of the test case using the action the last time that test case switched to the "Automated" status;
- The Last implementation date column indicates the date when a test case using the action switched to the "Automated" status for the last time.
View an Action from the Test Case workspace
From the Test steps tab of a BDD test case, you can directly access an action's consultation page by clicking on the button [...], then on Open the action word page:
You can only click on this option if you have an authorization for the project containing the action.
When clicking on this option, the action appears on a level-2 page. If you have the necessary rights, you can edit the description and modify the content of the Parameter block. The Information block indicates the project containing the action.
Manage an Action's Parameters
The block Parameter on an action's consultation page enables you to manage its name and the default value of its parameters. This block can be different depending on how the action was created.
When creating an action with a parameter from the Action word workspace:
- the name of the parameter is automatically entered in the Parameter block;
- the default value is empty.
Unless the name of the parameter is a number. In that case, please see below.
When creating an action with a "parameter" between ""
from the Test Case Workspace:
- the name of the parameter is automatically replaced by a generic value (
param1
,param2
, etc.); - the undefined value entered at the test step level is automatically entered as the parameter's default value.
You can modify the name and the default value of the parameter in the Parameter block:
- for the name of the parameter, only uppercase and lowercase letters, numbers, dashes
-
and underscores_
are allowed; - for its default value, every character is allowed except for
<
,>
and"
.
These two fields have a 255 characters limit minus the number of characters already in the action's fixed parts.
Action suggestions
With Squash Ultimate license 💎, action suggestions are activated when creating and editing test steps in BDD test cases.
How suggestions work
When you create or modify a test step, suggestions for actions already in the projects you are authorized on appear as you write. Words are predicted based upon the fixed parts of the action; the word order has no consequences on the suggestions that are made.
You can navigate between the different suggestions using arrow keys of your keyboard. To select a suggestion, click on it or press Enter. To add the selected action to the test case, press Enter.
Action suggestions across Projects
By default, the actions suggested when you create or modify a BDD test step are all the actions that are in the projects selected in the project filter. It is possible to refine or expand this selection with the Filter suggestions field. This way, only the actions that are in the selected projects are suggested. The actions suggested are all the actions that already exist in the projects on which you have reading rights.
There are two specific cases:
- The action suggested is both in the current project and in other projects;
- The action suggested is in one or multiple other projects.
1st Case: When the action suggested is both in the current project and in other projects, it is the action that is in the current project that will be linked to the test case.
2nd Case: When the action suggested is in one or multiple other projects, a pop-up enables you to choose the action's project that will be linked to the test case.
Give a Value to a suggested Action's Parameter
Within test steps, an action's parameter can be valued with a parameter value. This value is interpreted in the code as a variable. It can be anything and be different from one test case to another.
To define a parameter value in an action, you must write it in between quotes: "Value"
.
An action's parameter can also have delimited parameter. The parameter entered in the test step's action can have multiple values all defined in the test case's datasets.
To define delimited parameter in an action, you must write it between <>
: <value>
.
In Gherkin syntax, the use of these parameters implies a Scenario Outline.
Once you have selected a suggested action, you can modify its parameter in the input field and replace it either by a parameter value between ""
or by delimited parameter.
This modification will be specific to the test case. This test case will be linked to the suggested action even if the parameter is modified.
Copy/paste a BDD step across projects
When copying a step in a test case that is in another project, a pop-up enables you to choose the action's project that will be linked to the test case (source project or target project).