Writing Features with Gherkin
We write Features
in a structured manner, using a natural language subset called Gherkin (https://cucumber.io/docs/gherkin/reference/). Gherkin documents, such as a feature file, are written in a specific syntax. Most lines in a Gherkin document start with a keyword, followed by our own text. These keywords are as follows:
Feature
Rule
(as of Gherkin version 6)Scenario
(or example)Given
,When
,Then
,And
,*
Background
Scenario Outline
(orScenario Template
)Example
Comments are only permitted at the start of a new line, anywhere in the feature file. They begin with zero or more spaces, followed by a hash sign (#
) and some text. Gherkin supports over 70 languages, from Arabic to Uzbek, so we can write our Features
in any language we choose.
A Feature
's outline is as follows:
Feature: My Beautiful Feature # The Feature title 
## We can write anything we want from here until the next keyword ## As...