Format and Syntax

Gherkin files use the feature file extension. They’re saved as plain text, meaning they can be read and edited with simple tools. In this respect, Gherkin is very similar to file formats like Markdown, Textile, and YAML.

Keywords

A Gherkin file is given its structure and meaning using a set of special keywords. There’s an equivalent set of these keywords in each of the supported spoken languages, but for now let’s take a look at the English ones:

  • Feature

  • Background

  • Scenario

  • Given

  • When

  • Then

  • And

  • But

  • *

  • Scenario Outline

  • Examples

We’ll spend the rest of this chapter exploring how to use the most common of these keywords, which will be enough to get you started writing your own Cucumber features. We’ll come back to look at the remaining ...

Get The Cucumber for Java Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.