Introduction
Gherkin is a business readable language for test automation and test documentation. It is understood by Cucumber and together exists as a Behavior Driven Development tool.
Syntax
- Feature: this keyword signifies that what follows is a basic
description or name of the feature being tested or documented.
- Background: this keyword signifies steps that will be ran before every scenario in the feature.
- Scenario: this keyword represents the name or basic description of a
particular scenario testing the feature.
- Scenario Outline: This keyword signifies that the scenario will run N times for every argument listed in examples explicitly passed by column name wrapped in angled brackets.
- Examples: this keyword notes the list of static arguments that will be passed into a scenario outline.
- Given: this keyword represents a given step, or precondition that is assumed before
continuing. In the Arrange, Act, Assert paradigm, given represents
"Arrange".
- When: this keyword represents a when step, or the behavior
that is to be asserted against. In the Arrange, Act, Assert paradigm,
given represents "Act".
- Then: this keyword represents a then step, or
in other words, the step in which a behavior's result is validated.
In the Arrange, Act, Assert paradigm, given represents "Assert".
- And: This keyword is used in conjunction with any of the keywords above.
If you have two given statements, instead of explicitly calling Given
twice, you can say, " Given A And B".