How to write effective Gherkins?

Giridhar Rajkumar

@vgrk2017

Test Automation Consultant

https://thetestershub.info | https://learndevtestops.com

giridhar rajkumar

grajk88

Agenda

BDD - A Collaborative Model

3 Amigos - What is it?

Gherkins - Best Practices

Cucumber for BDD - Demo

Automated Acceptance Tests - Demo

Misunderstandings

BDD - A Collaborative Model

What is BDD?

Behavior-driven development (BDD) is an Agile software development process that encourages collaboration among developers, QA and non-technical or business participants in a software project. (Wikipedia)

BDD is NOT test automation

BDD - A Catalyst For Agile

• Talks Common Language

 

• Thinking "from the outside in", in other words implement only those behaviours which contribute most directly to these business outcomes, so as to minimise waste

 

• Describe behaviours in a single notation which is directly accessible to domain experts, testers and developers, so as to improve communication

Traditional Workflow

BDD Workflow

Gherkins

Gherkin is a set of grammar rules that are structured enough for all stakeholder to understand the requirements

It is a simple English text language that helps Cucumber tool to interpret and run automated acceptance tests

Documentation of the system behaviour

https://i.ndtvimg.com/i/2016-11/gherkins-620_620x350_81478162225.jpg

Gherkins - Annotations

Gherkin Scenarios should not be written from the team member like the developer, tester perspective. It should always be user perspective

Gherkins - Best Practices

Golden rules

1. In a given scenario, there should be only one Given, When and Then steps

2. Maximum usage of 2 And steps

3. Scenario should not exceed more than 5 steps

Gherkins - Best Practices

Gherkins - Best Practices

Comments

Gherkins - Best Practices

Background

Gherkins - Best Practices

Scenario-Outline

Scenario Outline

Gherkins - Best Practices

Tags

Gherkins - Best Practices

Wrong

Wrong

Right

Gherkins - Best Practices

Wrong

Right

Gherkins - Best Practices

Wrong

Right

Gherkins & BDD

Misunderstandings

1. Testers should write GWTs (Given When Then)

2. BDD means Business Driven Development

3. Gherkins are not your Test Steps

4. BDD means Test Automation

Gherkins - Best Tools

Tidy Gherkin

Cucumber

BDD Courses

How to write effective Gherkins?

By Giridhar Rajkumar

How to write effective Gherkins?

  • 170