Magic tags
Magic tags are Gherkin tags with special functionality within Autometa and can be used to manipulate test flow.
Currently the magic tags available are:
@skip
- Skips the test- Can be used on a
Feature
,Scenario
,ScenarioOutline
, orRule
- aliases:
@ignore
,@skipped
- Can be used on a
@only
- Only runs the test or suite it tags within that file.@retries=3
- Retries the test 3 times if it fails- Can be used on a
Feature
,Rule
,Scenario Outline
, orExamples
.- individual scenarios cannot be retried
- Any number of retries can be specified
- version >= 0.5.5
- Can be used on a
Scenario Outlines
Scenario Outlines can be tagged with magic tags and are run as a group of tests, however it is possible to use multiple Examples tables to control the flow of the tests.
Skips all scenarios:
@skip
Scenario Outline: my scenario
Given a <thing>
When I do a thing
Then I should see a thing
Examples: My Example A
| thing |
| foo |
| bar |
| baz |
Examples: My Example B
| thing |
| fizz |
| buzz |
Skips all Scenarios in example A:
Scenario Outline: my scenario
Given a <thing>
When I do a thing
Then I should see a thing
@skip
Examples: My Example A
| thing |
| foo |
| bar |
| baz |
Examples: My Example B
| thing |
| fizz |
| buzz |
Only run Scenarios in example B:
Scenario Outline: my scenario
Given a <thing>
When I do a thing
Then I should see a thing
Examples: My Example A
| thing |
| foo |
| bar |
| baz |
@only
Examples: My Example B
| thing |
| fizz |
| buzz |
Retries
You can retry tests in a feature or rule if they fail up to some number of times. This is useful for flaky tests.
feature file
@retries=3
Feature: My Feature
Scenario: My Scenario
Given I have a test
When I run the test
Then the test should pass
rule
Feature: My Feature
@retries=3
Rule: My Rule
Scenario: My Scenario
Given I have a test
When I run the test
Then the test should pass
scenario outline
Feature: My Feature
@retries=3
Scenario Outline: My Scenario
Given I have a test
When I run the test
Then the test should pass
Examples:
| thing |
| foo |
| bar |
| baz |
The following will retry only the Examples A scenarios.
examples
Feature: My Feature
Scenario Outline: My Scenario
Given I have a test
When I run the test
Then the test should pass
@retries=3
Examples: Examples A
| thing |
| foo |
| bar |
| baz |
Examples: Examples B
| thing |
| fizz |
| buzz |