Gherkin
How to write Gherkin Test Scenarios?
What is Gherkin language?
Gherkin is a business readable language which helps you to describe business behavior without going into details of implementation.
Gherkin
Purposes:
- Documents user scenarios
- Writing an automated test (BDD)
How to write Gherkin test cases?
How to write TCs
- Each scenario should execute separately
- Every feature should able to be executed along
- Steps information should be shown independently
- Connect your Scenario’s with your requirements
- Keep a complete track of what scenarios should be included in a requirement document
- Create modular and easy to understand steps
- Try to combine all your common scenarios
Best practices
Advantages:
- Gherkin is simple enough for non-programmers to understand
- Programmers can use it as a very solid base to start their tests
- It makes User Stories easier to digest
- Gherkin script can easily understand by business executives and developers
- Gherkin Testing targets the business requirements
- A significant proportion of the functional specifications is written as user stories
- You don’t need to be expert to understand the small Gherkin command set
- Gherkin Test cases link acceptance tests directly to automated tests
- Style of writing tests cases are easier to reuse code in other tests
Disadvantages:
- It requires a high level of business engagement and collaborations
- May not work well in all scenarios
- Poorly written tests can easily increase test-maintenance cost
Disadvantages