You are on page 1of 1

CHEATSHEET

Gherkin
CRE ATE D BY A ND Y KN I G H T AN D USE D WI T H PER M I SSI O N .

4 RULES Common Commands


for Good Gherkin @product @search

1 Write scenarios so that anyone can Feature: Google Searching


intuitively understand them. As a web surfer,
I want to search for things online,
2 One scenario should cover one
so that I can find what I want.
behavior.
Background: Given the Google home page is displayed
3 Don’t add unnecessary test variations -
focus on equivalence classes. Scenario: Simple Google search
4 Use proper, consistent English for clarity. When the search phrase "panda" is entered
Then results for "panda" are shown
Scenario: Simple Google search with related results
Other Advice When the search phrase "panda" is entered
Then results for "panda" are shown
Put the user story immediately under the And the following related results are shown:
feature title. | related |
Give meaningful one-line titles to | Panda Express |
scenarios and features. | red panda |
Always use Given-When-Then Scenario Outlines parameterize scenarios with multiple input
chronological order.
combinations.
Scenarios should have single-digit line The scenario will be run once per row in the Examples table.
lengths.
Make steps reusable with parameters Scenario Outline: Simple Google search for various phrases
surrounded by double quotes. When the search phrase "<phrase>" is entered
Then results for "<phrase>" are shown
Put common setup steps in the
And the related results include "<related>"
Background section to run before each
scenario. Examples: Shoes
| phrase | related |
Tags can be used on features or
scenarios for filtering and automation | panda | red panda |
hooks. | python | Python programming |

Contact us about BDD Training!

Copyright Beaufort Fairmont, LLC 2020. All rights reserved.

You might also like