What are Gherkin feature files?

Half cucumber on a white background
Photo by Mockup Graphics on Unsplash

Background

What are Gherkin feature files? They’re human-readable documentation that can map to automated tests.

Example

Here’s an example of using Gherkin to describe how to search for remarkablemark on Google:

Given I am on "https://www.google.com/"
When I click on the search bar
And I type "remarkablemark"
And I press "Enter"
Then I see in the search results "remarkablemark.org"
  • When describes the action.
  • Then states the expected outcome.
  • And chains successive Given’s, When’s, and Then’s.
Feature: Google search
Scenario: Search for remarkablemark
Given I am on "https://www.google.com/"
When I click on the search bar
And I type "remarkablemark"
And I press "Enter"
Then I see in the search results "remarkablemark.org"

Resources

To learn more about the syntax, go to Gherkin Reference.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store