Behavior-Driven Development (BDD)

BDD stands for Behavior-driven development and is based on TDD (Test Driven Development) where we write test cases first and then we write code.

BDD bridges the gap between stakeholders (people who are from the business side –  sales, marketing, business analyst, product owners) and the development team (QAs and developers).

Stakeholders most of the time are non-technical, these people only understand the business.

They always have the quality of the product in mind and the automation test case written is too technical for these stakeholders.

In BDD we create feature files and the test cases in these files are written using Gherkin language. Gherkin language uses plain text descriptive English (or some other 20 languages).

Also, the test cases are written keeping business in mind. The requirements shared by business analysts and the product owners are converted into scenarios with real examples.

This way it gets easy for stakeholders (business people)  to understand test scenarios and brings confidence in the quality of the product.

In some organizations, there is a trend that business analyst (or product owners) writes the feature files and in a few other organization BAs and POs reviews the test scenarios.

BDD supported tools:

There are many tools which support BDD like

  • 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 that makes it easy for everyone (developers, QAs, stakeholders, and others whosoever are involved in development) to understand the business scenarios or behavior.

The whole Idea of Gherkin is to be able to express scenarios in a 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
    • A feature file has only one “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 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: