Introduction to Gherkin Language

Gherkin is a languages we use for writing Cucumber and Behat features. Feature consist of steps derived from our Business requirement and program implementation. Clear and better communication is most important while we are building software.

There is possibility, because of misunderstanding, 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. So, It becomes very important for us to understand the power and usage of Gherkin language.

Key Points about Gherkin Language

  • Gherkin's syntax is that it is not tied down to one particular spoken language. Each of Gherkin's keywords has been translated into more than forty different spoken languages.
  • We can call Gherkin a programming language.
  • Gherkin Primary goal is human readability. Gherkin is designed to be easy to learn by non-programmers, yet structured enough to allow concise description of examples to illustrate business rules in most real-world domains.
  • It gives you the ability to remove logic details from behavior tests.
  • Gherkin serves as your project's documentation as well as your project's automated tests. Gherkin is a Business Readable, Domain Specific Language created specifically for behaviour descriptions. 

Example Scenario written in Gherkin Language

#Sample Feature Definition Template

Feature: Title of your feature
  I want to use this template for my feature file
  
  @tag1
  Scenario: Title of your scenario
    Given I want to write a step with precondition
    And some other precondition
    When I complete action
    And some other action
    And yet another action
    Then I validate the outcomes
    And check more outcomes

Video Tutorial: Introduction to Gherkin Language

Read Next: List of Gherkin Language Keywords