Gherkin – basic syntax and illustration
Gherkin uses a declarative textual format for the features to be tested. It has a line-oriented approach as a language and uses indentation for defining structure. Each source file of Gherkin consists of only one feature description. Let’s discuss the syntax used in Gherkin Language:
- Feature: This is a brief description of what is desired as part of the business flow / use cases. It provides the business rules that govern the scope of the feature and any additional information that will make the feature easier to understand.
- Scenario: This is some determinable business flow.
- Given: This is some precondition.
- And: This is some other precondition.
- When: This is some action by the actor.
- And: This is some other action.
- And: This is yet another action.
- Then: This is some testable outcome achieved.
Also, something else we can check happens too:
Scenario: This is a different flow.
In the preceding Gherkin syntax:
- Feature: This describes the business...