Abstract
Behavior Driven Development (BDD) has gained high attention & adoption in agile
development projects in recent years. This article provides basic understanding of BDD
& fundamental practices followed in Behavioral Driven Development projects.
Introduction
Behavioral Driven Development is an Agile software development process which is
based on Three Amigo concept i.e. Developer, QA & Business participants. The
language used in writing BDD is the natural and simple language which enhances
collaboration between technical and non-technical team.
BDD = Business Behavior + TDD (test driven development)

In Figure.2 below, we can see that different person perceives an elephant differently, because
everyone is in their own space.

Now consider elephant as a software requirement and if developer, tester and business
analyst start staying in their own worlds, then the final product will be always be disaster
because it will be seen as a spear, fan or a rope.
Hence it is recommended that all actors of development process see the requirement
from same lens and BDD Gherkin language provides that feature.
Why Gherkin Language?
Different teams in the project need a common language to express requirements.
This language should be simple enough to be understood by Business team members and should be explicit enough to remove most of the ambiguities for developers and testers.
This language should open up the thinking of team members to come up with more scenarios. As you express more details you try to visualize the system more and hence you end up making more user scenarios. This language is good enough to be used as project documentation.
Gherkin is a simple, lightweight and structured language which uses regular spoken language to describe requirements and scenarios.
Feature Files
Feature: Users should be able to login into Amazon Application with Valid credentials
In order to Login into the Application
As a Registered user
I want to enter valid credentials
Scenario Outline: Login into Amazon Application
Given I am on Amazon Website
When I Enter valid "<Username>" and "<Password>"
And I click on Login Button
Then I should see my account details
Examples:
| Username | Password |
| User1 | password1 |
| User2 | password2 |
Step Definition
@And("^And I click on Login Button$")
public void An_ I_click_on_Login_Button() throws Throwable {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
@Then("^Then I should see my account details\"([^\"]*)\"$")
public void Then_I_should_see_my_account_details (String arg) throws Throwable {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
A Feature File example gives clear picture of requirement, behavior and functionality.
In an Agile project a Business Analyst can write the requirement in Given, When & Then
format and once requirement is refined then Developers & Quality Engineers can start
coding the functionality.
BDD tools
Cucumber (Java, Ruby, Javascript, Python)
Jbehave(Java)
Concordion(Java)
Specflow(C#)
EasyB(Java)
Specflow(Ruby)
Benefits of Behavioral Driven development
Brings everyone on same page
Reduce handovers
Simplifies requirement traceability via feature files
Test coverage gets easier with feature files
Support progressive & regressive test automation
BDD reports are easy to understand
Supports Shift-Left approach
Academia Paper: https://www.academia.edu/43902522/Behavior_Driven_Development_in_Agile_Projects
Comments