Testing beyond limits!

Search This Blog

Tuesday, September 26, 2017

What is Gherkin (for Cucumber)?

Gherkin is an English like language to express tests without any ambiguity. It consists of a set of
keywords used in a feature file to describe various components listed in it. Nothing more, that's it.

 It is a language easy to understand and write by all, thus making one able to understand and express application behavior concretely with solid requirements. Team is able to build better scenarios around already set concrete list of scenarios.

The whole idea of Gherkin is to make tests more readable. Having the ability to write tests in English like language, Even people like stakeholders with non-technical background will be able to understand your tests. They would be able to come up with more scenarios and define clear expectations which is always good to have.

Sample feature file in Cucumber:

Feature: Login functionality for Gmail.com

Scenario: Verify that user is able to successfully login using valid username and password to Gmail
Given A user is on Gmail website
When User clicks on Sign in link
And User logs in using valid username and password
Then User is taken to My Account page

No need to worry about keywords like Feature, Scenario, Given, When, And, Then. We will discuss these keywords in future posts. Happy Testing!