Skip to main content

List of Gherkin Language Keywords

Gherkin has its own set of keywords and each keyword has some meaning. To learn how to write steps in Gherkin language you must be familiar with its keyword. If you are using any editor you will find these keywords are highlighted with some color. Each keyword is translated to many spoken languages; in this reference we’ll use English.

Categories of Gherkin Keywords

  • Primary Keyword: Feature, Rule, Scenario, Example or Scenarios, Given, When, Then, And, But, Background, Scenario Outline, Examples
  • Secondary Keyword: Doc String("""), Data Tables(I), @(Tags), #(Comment) 

Each step starts with Given, When, Then, And, or But.

A complete list of Gherkin Primary Keywords and their synonyms

Keyword Synonyms Description
Feature Business Need, Ability Begins a Gherkin file.
Background   Runs steps before Scenario
Scenario   Starts a new scenario
Scenario Outline Scenario Template Starts a new scenario with multiple examples
Given *, And, But Puts the system in a predefined state
When *, And, But Perform an Action
Then *, And, But Tests for consequence
Example Scenarios List examples for Scenario Outline
Rule   Represent one business rule that should be implemented

Note: And is used for statements that are an addition to the previous steps and represent positive statements. But are used for statements that are an addition to the previous steps and represents negative statements.

Video Tutorial

About

Elix is a premium wordpress theme for portfolio, freelancer, design agencies and a wide range of other design institutions.