Conjugation in Given When Then Gherkin Steps
Gherkin
22/08/2022
There are no hard and fast rules when it comes to writing Gherkin scenarios. Nonetheless, following the past-present-conditional tense structure is typically seen as good practice.
Given
Given
statements are passive and set up a context or condition for the entire scenario. They indicate that something already happened and might still be taking place.
GHERKIN
Given User navigated to the login page (past tense)Given User is on the login page (present continuous)Given User has been granted admin privileges (perfect tense)
The exact tense to use is up to you!
When
When
statements are active and indicate that an event is occurring. Naturally, this means the present tense should be used.
GHERKIN
When User enters their username and password (present tense)When User clicks "Log in" (present tense)
Then
Then
statements are passive and indicate an expected yet uncertain outcome, state or behaviour.
GHERKIN
Then User should be logged into website (conditional tense)
The keyword should
is quite suited to indicate this sentiment.