Attributes available throughout a feature file
The following elements can be used multiple times in a feature file.
Comments
Feature files can have comments. In Gherkin, a comment is any line that starts with a #. Comments are ignored when executing a feature file. Comments can be used to provide additional clarification about why a scenario was written in a given way.
For example:
# For these tests to succeed, multicurrency must be enabled.
Scenario outlines
A scenario tests a single behavior and has a single outcome. However, there can be circumstances where a set of scenarios have nearly identical behaviors and nearly identical outcomes. Each scenario may vary by only a single value.
A scenario outline is a Gherkin feature that captures multiple, nearly identical scenarios into a single set of steps. A scenario outline is always followed by an Examples table. This table defines the different values to use for each execution of the outline.
For example, consider the following scenario outlines:
Scenario Outline: Add coverages without terms to a submission
Given a Personal Auto submission
And the job status is "Draft"
When I add the coverage "<coverage>" line-level coverage
Then the "<coverage>" line-level coverage should exist
Examples:
| coverage |
| Medical Payments |
| Underinsured Motorist - Property Damage |
| Mexico Coverage - Limited |
- The first iteration of this scenario outline will test adding the Medical Payments coverage.
- The second iteration of this scenario outline will test adding the Underinsured Motorist - Property Damage coverage.
- The third iteration of this scenario outline will test adding the Mexico Coverage - Limited coverage.
Note the following syntax conventions and restrictions for scenario outlines:
- A scenario outline starts with the text "Scenario Outline:", not "Scenario:".
- When a value in a step comes from the Examples table, the value must be written as
"<header>", where:
- header is the label at the top of the appropriate Examples table column, and
- header is delimited by a < and a >.
- The values must use only alphanumeric characters. They cannot include special characters such as the slash (/) character.
