In some cases you may want to rerun the same scenario over and over, substituting out the arguments. In this case, Gherkin provides several new keywords to accommodate this situation, Scenario Outline: and Example:. The Scenario Outline keyword tells Cucumber that the scenario is going to run multiple times substituting out arguments from a list. The Examples keyword is called before the list is explicitly notated. Arguments for Scenario Outlines should be wrapped in angled brackets. In the example below, note that the argument names wrapped in the angled brackets correspond to the column names listed under Examples. Each column is separated by vertical bars, with column names on the first row.
Feature: Product Login
As a user, I would like to be able to use my credentials to successfully
login.
Rules:
- The user must have a valid username
- The user must have a valid password
- The user must have an active subscription
- User is locked out after 3 invalid attempts
- User will get a generic error message following
login attempt with invalid credentials
Background: The user starts out on the login page
Given the user is on the login page
Scenario Outline: The user successfully logs in with their account
This scenario outlines tests in which various users attempt
to sign in successfully
When the user enters their <username>
And the user enters their <password>
Then the user should be successfully logged on
Examples:
| username | password |
| frank | 1234 |
| jack | 4321 |