Professional Documents
Culture Documents
Cucumber Gherkin Language
Cucumber Gherkin Language
Feature: Summary
Scenario: Title
Given [Some Initial Context- Past tense]
When [An event occurs - Present tense]
Then [Ensures some outcome - Future Tense]
Gherkin documents are stored in regular text files with a .feature file extension.
When you run Cucumber, it will generate a report that verifies whether or not the
software behaves the way the Gherkin document says.
Testers can write some code that translates the text in the Gherkin document into
interactions with the software.
- Feature
- Background
- Scenario
- Given
- When
- Then
- And
- But
- *
- Scenario Outline
- Examples
Feature
Each Gherkin file begins with the Feature keyword. This keyword
doesn’t really affect the behaviour of your Cucumber tests at all;
it just gives you a convenient place to put some summary
documentation about the group of tests that follow.
In valid Gherkin, a Feature must be followed by one of the
following: • Scenario • Background • Scenario Outline
Scenario
To actually express the behaviour we want, each feature contains
several scenarios. Each scenario is a single concrete example of
how the system should behave in a particular situation. If you add
together the behaviour defined by all of the scenarios, that’s the
expected behaviour of the feature itself.
Given, When, Then
In Gherkin, we use the keywords Given, When, and Then to
identify those three different parts of the scenario:
http://www.slideshare.net/kmstechnology
http://www.slideshare.net/alan_parkinson
http://chrismdp.com/2013/01/bdd-is-not-cucumber/