Skip to main content

Try Steps

Since v3.11.0

@Try

The @Try annotation can be used to ignore failures on individual steps. This can be useful for cases where you might have to deal with random components that may or may not appear on a page, such as promotional offers for example.

Consider the following example.

Try example
  Feature: My dashboard

Scenario: Open my dashboard
Given I am logged in as a customer
When @Try I dismiss the promotional offer
And I click the dashboard menu option
Then I should see the dashboard

The 2nd step in the scenario above is annotated with @Try and will not be treated as a failure if the promotional happens to be absent at the time of execution.

Steps annotated with @Try will always be treated as Passed, regardless of whether they execute succesfully or fail. In the event of failure, the step will be greyed out in the HTML reports and attachments on the step will contain the error details should you wish to inspect or analyse the cause.

Example Try step when ignored