Gherkin is a domain-specific language for describing formalized examples of how a system should interact with the user. In Behavior Driven Development, examples are discovered in collaboration with all parties involved in the software development process (developer, tester, subject matter expert, …) before they are formalized in Gherkin.

Tools like our free Online Gherkin Editor help you to quickly write Gherkin feature files and scenarios, which can then in the next step be automated with SpecFlow for acceptance testing.

Gherkin is used to describe features that can contain one or more scenarios. Scenarios are described using steps in a Given-When-Then structure. Scenario outline is another important Gherkin concept which describes a scenario template and a table of examples, where each row describes a variation of the scenario. Gherkin also defines concepts like tags which can be used to influence scenario execution.

Feature: Calculator

Scenario: “+” should add to current total
Given the current total is “5”
When I enter “7”
Then the current total should be “12”

Scenario Outline: Should support 
Given the current total is “”
When I enter “”
And I enter “”
Then the current total should be “”

| currentTotal | inputNumber | inputOperator | newTotal |
| 5            | 7          | +          | 12           |
| 5            | 7          | -             | -2          |
| 3            | 4          | *             | 12          |
| 9            | 3          | /             | 3          |

💡 Quickly write, download and share your own Gherkin feature files and scenarios with our free Online Gherkin Editor.