Create BDD specifications
This topic describes how to create BDD specifications in the Backlog module. You then create and run scenarios as described in Create BDD scenarios.
Create a BDD specification
Use the Backlog module to add BDD specifications.
To create a BDD specification:
-
In the Backlog module, open the BDD Specification tab, and click the Add BDD Specification button
.
Tip: You can also add a specification for a certain feature, in the feature's BDD Specification tab.
-
Enter the required values.
-
Click the Customize fields button
to show more fields in the Add BDD Specification dialog box.
-
Select the Script tab.
The script is generated with the Test ID (TID) and revision number (REV). If you automate the test, these lines help identify the Gherkin test for the test results.
1 #Auto generated Octane revision tag
2 @TID1001REV0.1.0
3 Feature:
Caution: Do not delete the Test ID tag. It is used to map the automation results.
-
In the Feature line, add a description of the feature.
-
Use the following buttons to automatically add template blocks to the script.
Button Description Add scenario Inserts a scenario block. Add scenario outline Inserts a scenario outline block with a table of Examples. Add rule Inserts a rule block with multiple scenarios. -
Click Save Version to save the current version of the script. Enter a label and click Save.
-
Click Versions to view, sort and compare the saved versions of the script.
-
Open the Details tab to add any other relevant information for the BDD specification, such as owner or linked backlog item.
-
Click Save to save the specification.
-
Run scenarios as described in Create BDD scenarios.
Localization
You can localize Gherkin test feature files and BDD specs using any language supported by Gherkin.
You define the language at the top of the feature file or script, using the standard Gherkin notation, # language
. For example, the "fr" notation is an instruction to use the French language.
# language: fr
When you click Add scenario or Add scenario outline, text is added in the language that you specified.
If no language is specified, the default English is used. Admins can set the language using the GHERKIN_SCRIPT_DIALECT parameter. For details, see Configuration parameters.
The last language used is remembered, so that when you create a new document, it will be in your specified language.
Tip: If your tests are automated, you can inject their results without having to manually create the BDD specification and scenarios. After the tests are injected, you can link items like application modules and backlog items to them. For details, see Automated scenario injection.
Reuse steps using the auto-complete mechanism
You can reuse test steps from a BDD specification. This enhances consistency and readability, and provides for more efficient code by preventing duplication.
To enable reuse, you first define which BDD specifications are included in the auto-complete mechanism. You can assign a specification to a reuse category based on your workflow. After specifications are defined as contributing to auto-complete, you can then reuse test steps.
To create an auto-complete library for reuse:
-
Open a BDD specification's Details tab and add the fields Contributes to Auto-Complete and Auto-Complete category.
-
Define Contributes to Auto-Complete as Yes.
-
Define the Auto-Complete category according to your testing environment needs. The default is Main.
The site admin can add categories using Settings > Lists > Auto-Complete categories.
To reuse test steps using the auto-complete mechanism:
-
Create a specification. When you start typing a step, press CTRL+space to see a list of related steps available in the spec's category. Select the step you want to reuse.
-
If there is only one relevant step available, it is automatically filled in.
An icon indicates how many times each test step has been reused in the workspace.
-
When a step contains parameters, the auto-complete options do not display the exact parameter names, to enable reuse with other parameters.
Note: Auto-complete supports multiple languages. Tests written in one language are not provided suggestions from tests written in other languages.
Code alignment on the BDD specification
The Code alignment field describes whether the script on the BDD specification is aligned with the external automation script, as follows:
-
The Code alignment status of new BDD specifications that are created starts as N/A.
-
After automated results start being received for one or more of the scenarios, the external script version is compared to the version in OpenText Core Software Delivery Platform.
-
If they are the same, the field value is Aligned.
-
If the script was changed externally, those changes need to be approved, the value is Approve external updates.
-
If someone makes a change in the BDD specification and the automation should be updated accordingly, the value is Update external code.
-
Next steps: