{"id":63,"date":"2019-06-17T12:44:20","date_gmt":"2019-06-17T12:44:20","guid":{"rendered":"https:\/\/www.bddtesting.com\/?page_id=63"},"modified":"2019-06-17T12:44:21","modified_gmt":"2019-06-17T12:44:21","slug":"gherkin-syntaxreference","status":"publish","type":"page","link":"https:\/\/www.bddtesting.com\/gherkin-syntaxreference\/","title":{"rendered":"Gherkin syntax(reference)"},"content":{"rendered":"\n

Gherkin uses a set of special keywords to give structure and meaning to executable specifications. Each keyword is translated to many spoken languages; in this reference we\u2019ll use English.<\/p>\n\n\n\n

Most lines in a Gherkin document start with one of the keywords<\/a>.<\/p>\n\n\n\n

Comment lines are allowed anywhere in the file. They begin with zero or more spaces, followed by a hash sign (#<\/code>) and some text. Comments do have to start on a new line.<\/p>\n\n\n\n

Either spaces or tabs may be used for indentation. The recommended indentation level is two spaces. Here is an example:<\/p>\n\n\n\n

Feature: Guess the word\n\n  # The first example has two steps\n  Scenario: Maker starts a game\n    When the Maker starts a game\n    Then the Maker waits for a Breaker to join\n\n  # The second example has three steps\n  Scenario: Breaker joins a game\n    Given the Maker has started a game with the word \"silky\"\n    When the Breaker joins the Maker's game\n    Then the Breaker must guess a word with 5 characters<\/code><\/pre>\n\n\n\n

The trailing portion (after the keyword) of each step is matched to a code block, called a step definition<\/a>.<\/p>\n\n\n\n

Keywords \ud83d\udd17\ufe0e<\/a><\/h1>\n\n\n\n

Each line that isn\u2019t a blank line has to start with a Gherkin keyword<\/em>, followed by any text you like. The only exceptions are the feature and scenario descriptions.<\/p>\n\n\n\n

The primary keywords are:<\/p>\n\n\n\n