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.
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
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.
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.
If you plan to implement BDD, here are a few points that will benefit the software team.
Even the best development approaches can have pitfalls and BDD is no exception. Some of them are: