Search

Behavior Driven Development in Agile Projects | Hemanshu Chauhan

Updated: Oct 12, 2020

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?

  1. Different teams in the project need a common language to express requirements.

  2. 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.

  3. 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.

  4. 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

  1. Cucumber (Java, Ruby, Javascript, Python)

  2. Jbehave(Java)

  3. Concordion(Java)

  4. Specflow(C#)

  5. EasyB(Java)

  6. Specflow(Ruby)

  7. Benefits of Behavioral Driven development

  8. Brings everyone on same page

  9. Reduce handovers

  10. Simplifies requirement traceability via feature files

  11. Test coverage gets easier with feature files

  12. Support progressive & regressive test automation

  13. BDD reports are easy to understand

  14. Supports Shift-Left approach

Academia Paper: https://www.academia.edu/43902522/Behavior_Driven_Development_in_Agile_Projects


#TDD #QE #BDD

235 views0 comments

Recent Posts

See All