What is BDD? An Intro to Behavioral Driven Development

What is BDD? An Intro to Behavioral Driven Development

Behavioral Driven Development(BDD) is a software development approach that has evolved from TDD(Test Driven Development). BDD is written in simple English language which improves communication between tech and non-tech teams and stakeholders. In both development approaches, tests are written ahead of the code, but in BDD, tests are more user-focused and based on the system’s behavior.

Why BDD?

TDD works better, as long as the business owner is familiar with unit testing framework used, and their technical skills are strong enough, which is not always the case. In such circumstances, BDD has an edge over TDD, because the test cases can be written in common language i.e English. This access to clearer, low jargon communication is one of the biggest advantages of BDD.

Essentials required before implementing BDD

  • Requirements should be converted into user stories that can define concrete examples.
  • Each example should be a valid user scenario, rather than a mere test case.
  • An understanding of the ‘given-when-then’ formula.
  • An awareness of the need to write ‘the specification of the behavior of a class’ rather than ‘the unit test of a class’.

The ‘Given-When-Then’ BDD formula

This is the proposed template for writing BDD test cases for a user story, which can be defined as:

Given a certain scenario
When an action takes place
Then this should be the outcome.

A practical example would be:-

Given the user is on the facebook login page.

When the user enters the user name and password

Then it should be there.

BDD Tools


Cucumber is a test framework that supports BDD. In Cucumber, the BDD specifications are written in plain, simple English which is defined by the Gherkin language. In other words, Gherkin is a language that Cucumber understands. Gherkin presents the behavior of the application used, from which Cucumber can generate the acceptance test cases. Cucumber is a framework developed by Ruby that can work across different technologies.

Some benefits to using BDD

If you plan to implement BDD, here are a few points that will benefit the software team.

  1. You are no longer defining ‘test’, but are defining ‘behavior’.
  2. Better communication between developers, testers and product owners.
  3. Because BDD is explained using simple language, the understanding is much better.
  4. Being non-technical in nature, it can reach a wider audience.
  5. The behavioral approach defines acceptance criteria prior to development.

Disadvantages of BDD

Even the best development approaches can have pitfalls and BDD is no exception. Some of them are:

  1. To work in BDD, prior experience of TDD is required.
  2. BDD is incompatible with the waterfall approach.
  3. If the requirements are not properly specified, BDD may not be effective.
  4. Testers using BDD need to have sufficient technical skills.

Post a comment

Login to Portal