In our previous tutorial, we discussed Test Driven Development, which in short called as TDD. We have seen that TDD is mainly Test centric which clearly means that the test will be written first then development will be processed only when a defect comes. Today’s agenda is Behaviour Driven Development and we call it as BDD in short.
Behaviour Driven Development is the extension of Test Driven Development model of Software development. It is suggested that you first understand the TDD model then jump to this tutorial as it will help you in building a systematic knowledge base. If you are already aware of TDD then you can ignore my suggestion. 😊
What is Behaviour Driven Development (BDD)?
Behaviour Driven Development (BDD) is a descriptive software development technique in which a software application designed and developed based on the way of the performance observed from its behaviour.
Dan North introduced the concept of BDD in 2003. In words of Dan North, BDD defined as-
Behaviour Driven Development (BDD) is a second generation, outside in, pull based, multiple stakeholder, multiple scale, high on automation, agile methodology. It describes the cycle of interactions with well-defined outputs, resulting in the delivery of working tested software that matters.
Let’s get to know the features of BDD.
Features of Behaviour Driven Development (BDD)
Below points highlight some of the most important features of the BDD.
- It supports team-centric workflow, which simply means as the team will find out the requirements by giving the common understanding to the work
- BDD uses the simple language which is easier for team members to read and interpret
- It mainly focusses on the behavioural aspect of the application
- BDD enhances the collaboration with different stakeholders
Benefits of using BDD
Some of the benefits of using Behaviour Driven Development are as follows:
- It incorporates collaborative environment thereby customer, business analyst, developers, testers, support engineers and other project related stakeholders are closely working
- Developers get a clear understanding of the requirement in terms of feature, hence, it increases the business value
- BDD uses a common language (let’s say Gherkin), which is understood by all the team members, hence, it reduces the confusions and misunderstanding
- Ultimately, it reduces the costs because of a clear understanding of the requirement
- It works on the principle of defining the behaviour of the application
- BDD adds the feeling of ownership in the team
- It produces confidence in developers and extends happiness to the customers
Behaviour Driven Development and Agile Methodology
BDD is not compatible with the waterfall model, hence, it is the best fit for the Agile methodology. It possesses all the characteristics which are required for the Agile model. Below comparative study shows the common characteristics between Agile methodology and Behaviour Driven Development (BDD) model. Let’s have a look:
- We develop a working software which aligns with the business value in BDD
- Stakeholders quickly respond to change through the continuous chain of communication in the team
- Behaviour Driven Development involves interactions of each individual through a common communication channel
- BDD incorporates continuous feedback from the customer through collaboration among customers, team and other project related stakeholders
How to implement BDD in the project?
Let’s discuss some of the tools used for BDD implementation.
Cucumber: It is a framework which helps to implement Behaviour Driven Development (BDD). We define test steps (or acceptance criteria) in plain English. Gherkin is used to extend the steps written in simple English. It supports Ruby, Java, C#, and Python.
SpecFlow: It is another testing tool which supports BDD. It is like Cucumber, based in .Net. Basically, it uses all the techniques used in Cucumber, hence, it is called as Cucumber for .Net.
JBehave: A BDD tool which is mainly used for Java. It was developed by Dan North.
EasyB: It is again a BDD framework for Groovy.
Sample Cucumber Feature file
Below script is an example of a cucumber feature file which implements the login scenario of an anonymous web application.
Feature: Login- User should be able to login to the application
Scenario: User should be able to land on My Account page on successful login
Given user opens the website
And user clicks on the Login link
When the user enters the username and password
And click on the login button
Then user lands on My Account page
This was all about Behaviour Driven Development (BDD). Stay tuned as more tutorials are available on Cucumber implementation in the Selenium project.