Behavior-Driven Development (BDD)

11 months ago

BDD stands for Behaviour-driven development and is based on TDD (Test Driven development) where first test cases are written first and the code to the application is added.

BDD bridges the gap between stakeholders and development team.

In BDD test cases are written in plain English language (and some 20 more languages like french etc.) also known as Gherkin language (we will discuss the Gherkin language in detail in future tutorials)

Features of BDD:

– Test cases are written plain text and is easy to understand even by non-technical people or by people who only understand business – Business stakeholders and business analysts, compared to traditional automation where only people with good understanding of code can only understand what we are testing.

– Test cases are written keeping business scenario in mind

BDD supported tools:

– Cucumber
– Jbehave
– Nbehave
– Specflow

Cucumber and SpecFlow are two most famous tools and very similar, they both have the same syntax, cucumber is in Java whereas SpecFlow is with C-Sharp

Gherkin Language:

Gherkin is a simple, light weighted and structured language which makes it easy for everyone (Developers, QA, stakeholders and others whosoever is involved in development) to understand the business scenarios or behavior.

The whole Idea of Gherkin is to be able to express scenarios in more readable format. So that it becomes easy to understand the requirements and also to express requirements without ambiguity.

By having the ability to express scenarios in English or other native language, stakeholders who most of the time are non-technical people get an opportunity to describe their applications expected behavior.

Gherkin has some spaces and indentation to define the structure.

Keywords or syntax used in Gherkins:

  1. Feature
  2. Background
  3. Scenario
  4. Given
  5. When
  6. Then
  7. And
  8. But
  9. Scenario outline
  10. Examples
  11. Scenario Templates

In upcoming tutorials, we will learn all the above syntax with real-time examples on the real-time websites.

PS: For any questions, queries or feedback. Feel free to write us at or

Saurabh Dhingra

About the Author

Saurabh Dhingra

Follow Saurabh Dhingra: