Xray v3.2 introduces the Automated Steps Library which provides a centralized point to manage automated steps and allow easy refactoring of steps (Cucumber/Gherkin only).
Refactoring is the key word and is essential to maintain your automation code base sane.
Since steps are persisted and indexed, they can then be used for autocomplete purposes during the creation/update of Cucumber Scenarios/Backgrounds, facilitating their creation and avoiding duplicated or messy steps.
A general setting, available in Global Preferences, allows you to globally opt-in or opt-out for this feature. If the Automated Steps Library is not enabled, users can still specify Cucumber Scenarios/Backgrounds, although lacking the autocomplete ability.
The Automated Steps Library provides a per project organization for all the steps used in automated (Cucumber only) Tests and Pre-Conditions belonging to that project.
In other words, the library provides a centralized point to manage all Gherkin sentences (i.e. the Cucumber "steps" ) of all the Tests and Pre-Conditions of a given project.
Steps are automatically added to the Automated Steps Library of a project whenever a Cucumber Test/Pre-Condition of that project is created or updated. Likewise, they're automatically removed if they are not being used by none of those entities, in that project.
Steps are always, and indirectly, automatically created in the library whenever creating/editing a Cucumber Test/Pre-Condition. Steps cannot be created within the Automated Steps Library itself.
On the left side of UI steps can be searched and filtered by labels, while on the right side the step content can be edited and saved.
The Automated Steps Library provides the means to:
- refactor steps, by easily renaming them (i.e. changing their specification)
- refactor steps, by merging similar steps and avoiding duplicated specifications & associated code
- see which Tests/Pre-Conditions are using a particular step
- label steps, so they can be categorized, to ease their management and the step autocompletion during Test/Pre-Condition edition
In the Automated Steps Library you cannot:
- create/remove steps (this is done automatically, whenever creating/editing/removing Cucumber Tests/Pre-Conditions)
Steps, from the current Automated Steps Library perspective, correspond to Gherkin sentences used by Cucumber Tests/Pre-Conditions (i.e. Cucumber Scenario, Scenario Outline, Background).
Steps are case insensitive and their content is trimmed (i.e. spaces removed at the start/end).
Gherkin reserved keywords (e.g. Given, When, Then, And) are not stored in the library, so these two following steps are equally stored as "I have a calculator":
|Step as written in a Cucumber Test/Pre-Condition
Given I have a calculator
And I have a calculator
I have a calculator
Steps can be updated/refactored in the Automated Steps Library; they can also be implicitly updated or created whenever editing or creating a Cucumber Test/Pre-Condition.
However, they cannot be created from within the Automated Steps Library UI, in order to avoid dummy/unused steps. In other words, if a step appears in the Automated Steps Library then most probably it is been used by some entity. Exceptions may arise though, specially if the library is disabled somewhere in time or if for some reason Xray was unable to process an update/creation Jira event.
Integrity Checker, or a specific option in the project settings, may be used to force a per-project synchronization of steps, in case you find orphaned or missing steps in the library.
For a full comprehensive list of the available operations and how to perform them, please check Automated Steps Library.