Skip to main content

Gherkin Language

Gherkin is the Business Readable, Domain Specific Language, which serves as your project's documentation and automated tests. It is a non-technical and human-readable language that collectively describes use cases relating to a software system.

Why Gherkin Language

  1. Translate in many languages: Gherkin's syntax is not bound to one particular spoken language. You can translate Gherkin's keyword into more than forty different spoken languages.
  2. Easy to Understand: Gherkin's Primary goal is human readability. Gherkin is designed to be easy to learn by non-programmers, and it is structured enough to allow the concise description of examples to illustrate business rules in most real-world domains.
  3. Logic and Behavior Separation: It gives you the ability to remove logic details from behavior tests.
  4. Less Documentation: Gherkin is created explicitly for behavior descriptions. You can write your project requirement in Gherkin language, and same you can reuse and modify it as your manual and automation tests. 
  5. Supported Tools: Many BDD tools like Cucumber, Behat, SpecFlow, etc., use Gherkin as the primary language of writing tests.
  6. Save Time and Money: Clear and better communication is most important while building software. Because of misunderstanding, there is a possibility that code that we have worked hard for several days has been thrown away when we have developed what was not required. Using Gherkin, we can avoid such waste of time and money. 

Example Scenario written in Gherkin Language 

Given I am on the home page
When I Click on Login Link
And I fill in username with "xyz"
And I fill in password with "abc"
And I click on Login button
Then I should see My Account Page

This is a sample Gherkin Scenario for Login functionality written in the English Language. 

In the same way, you can write your project stories and manual test in the language of your choice and map these Gherkin Steps to your automation code.

Video Tutorial: What is Gherkin language?

Submitted by tgoswami on December 21, 2016

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.