Gherkin Format For Behavior Driven Development

Posted By : Smita Gupta | 22-May-2018

As we know BDD is adopting by most of the companies nowadays and the technology is very much in demand for automation because of its pretty plain text feature which can be easily understandable by anyone including Business analyst, developer, manual QA or an automation test engineer.

 

There are many tools which are supported by BDD and these tools are written in a different language like Java, Ruby, C#.

There is one language in common for all these tools which is Gherkin.

 

Let’s discuss what is Gherkin and its importance in the tools and how it is making automation so easy through BDD

 

1. Gherkin is actually a format for cucumber specification basically it is a language specification for BDD. It is a business readable and a  Domain specific language and it will let anybody to understand the behavior of a software very easily with no efforts because it is in plain text.

 

2. It has some spaces and indentation to define the structures. It has a  very few syntaxes which make the parser(the tool which uses gherkin) to behave based on the structures and it really makes sense because gherkin is a plain text and it will not have any syntax like a looping code like for loop, for each loop or it will not have a condition statements like if or it will not have using or import statements to input a library and other stuff . It simply looks like very simple plain text

 

Some of the syntax which gherkin has --

Feature

Background

Scenario

Given

And

When

Then

| userName | Password | CPassword |

And the Parsers, which actually a tool uses in gherkins  know these syntaxes and knows it has to be done something based on the command which is even in the plain text

 

Eg of a Gherkin Plain Text file ----

Scenario --- Registering a user in a website with minimal password combination

 

Feature:  UserRegistration

       Check for the Home page

       See of the registration is working

       Also verify if the registered user is displayed

 

Background:

       Given Clear the already created users before starting scenario

 

Scenario: Register a User with minimal password combinations

       Given I have opened the Development site

       And I seen the Home page loaded

       When I click the register link

       Then I should see the Register page

       And I fill the form with details

       | userName | Password | CPassword |

       | xxxUser     | xxxx   | xxxx   |

 
Related Tags

About Author

Author Image
Smita Gupta

Smita is a QA Engineer having experience in Manual and Automation testing and willing to take more experience and learning in new and different domains.

Request for Proposal

Name is required

Comment is required

Sending message..