Scenario

A scenario is an element of the Gherkin language that describes an example using Given-When-Then. A Gherkin scenario consists of a title, description and an arbitrary number of scenario steps (Given, When, Then). Although the scenario title and description are just plain text, scenario steps are described in natural language (but can be bound to automation code with tools like SpecFlow).

Scenario Example:

Scenario: “+” should add to current total
Given the current total is “5”
When I enter “7”
Then the current total should be “12”

A scenario outline is a scenario template that can be filled with examples from an example table, where each row contains a separate scenario.

Scenario Outline Example:

Scenario Outline: Should support 
Given the current total is “”
When I enter “”
And I enter “”
Then the current total should be “”

Examples:
| currentTotal | inputNumber | inputOperator | newTotal |
| 5            | 7           | +             | 12       |
| 5            | 7           | -             | -2       |
| 3            | 4           | *             | 12       |
| 9            | 3           | /             | 3        |

To learn more about how write Gherkin scenarios and view additional examples,  continue in our documentation.

💡 Quickly write, download and share your own Gherkin feature files and scenarios with our free Online Gherkin Editor.