top of page

BDD (Behavior Driven Development) Framework

What is a framework?

A framework in programming is a tool that provides ready-made components or solutions that are customized in order to speed up development.

Different Types of Framework used in Automation Testing.

  • Data-driven framework

  • Keyword driven framework

  • Hybrid framework

  • BDD framework

We are going to see about BDD.

What is BDD framework?

  • Behavior Driven Development is a software development approach that allows the tester/business analyst to create test cases in simple text language (English).

  • BDD mainly focuses on the behavior of the product and user acceptance criteria.

  • Cucumber is one of the best tools used to develop in the BDD Framework.

  • The simple language used in the scenarios helps even non-technical team members to understand what is going on in the software project.

  • This helps and improves communication among technical and non-technical teams, managers, and stakeholders.

  • Cucumber is a testing approach which supports Behavior Driven Development (BDD).

  • It explains the behavior of the application in a simple English text using Gherkin language.

Why Use BDD Framework?

  • Before the BDD framework, everyone was using TDD.

  • TDD works fine in software development, provided the stakeholders are familiar with the framework being used and their technical knowledge is sufficient.

  • However, this may not be the case always.

  • BDD provides a path that acts as a bridge to overcome the gap between the technical and the non-technical teams.

  • Because the test cases are commonly written in simple text, i.e. English.

  • The main advantage of BDD is the low jargon and clearer approach which is easier to understand.

How to Implement the BDD Approach?

  • Test scenarios should be written in plain language with a detailed description of the test.

  • how to test the application and the application behavior which can be understandable by all.

  • Cucumber – A BDD Framework Tool

  • Cucumber is a Behavior Driven Development (BDD) framework tool to write test cases.

Given – When – Then Approach:

Given: Some given context (Preconditions).

When: Some Action is performed (Actions).

Then: Particular outcome/consequence after the above step (Results).

Sample Feature File:


Scenario: Login with valid Username and Password

Given Launch chrome Browser

When User Opens URL ""

When Click on Getstarted Button

Sample Step Definition File




public classSample {

@Given("^User is navigating to G-mail Login Page$")

public voiduser_is_navigating_to_G_mail_Login_Page() throws Throwable {

// Write code here that turns the phrase above into concrete actions


@When("^User need to enter username as \"([^\"]*)\" and password as \"([^\"]*)\"$")

public voiduser_need_to_enter_username_as_and_password_as(String arg1, String arg2) throws Throwable {

// Write code here that turns the phrase above into concrete actions


@Then("^User is successfully navigated to the G-mail Mail Box$")

public voiduser_is_successfully_navigated_to_the_G_mail_Mail_Box() throws Throwable {

// Write code here that turns the phrase above into concrete actions



Advantages Of BDD Framework:

1.Coverage of User Stories

  • Hybrid Framework with BDD is meant to be combined with different features.

  • Every resource in the software development phase can contribute to the BDD

  • framework.

  • Defined user stories from the business.

  • Criteria for the developers to determine if specifications meet business requirements.

  • Test scenarios for the testing team.

  • Shell cover for an automation tester which allows them to separately write their code

  • in step definition files.

  • Explained test scenarios for Stakeholders.

2. Clarity of Scenarios

  • Gherkin language uses plain layman text that is focused on the outcome of the product which is being tested/developed using BDD.

  • As feature file separate the technical description in a different step definitions file for automation testers.

  • it smartly helps a non-technical person to understand the automated test easily.

  • Any updates can be implemented in a small discussion.

  • Readability power of gherkin guarantees the clarity of scenarios to each of its user which in turn, helps in building the right product.

3. Automation of Test Scenarios

  • Cucumber implementation in a BDD framework allows an automation tester to easily initiate the scripting with the right approach.

  • Easy language of cucumber scenarios helps them to understand the functionality in a better way.

  • Cucumber is a language-independent plugin as it is compatible with many programming languages E.g. Java, Python, etc.

4.Code Reuse in Framework

  • Given – When – Then approach gives liberty to the testers to use the same steps as many times we want in the feature file which gradually helps in saving time for the automation testers.


Scenario: Scenario 1

Given User is navigated to Google Home Page When User searched “Cucumber” in the search engine Then Clicked on the Search Button And User can see search results for Cucumber in the web browser

Scenario: Scenario 2

Given User is navigated to Google Home Page When User searched “Selenium” in the search engine Then Clicked on the Search Button And User can see search results for Selenium in the web browser

In the above two scenarios, we can conclude that “Given”,When” and “Then” steps are reusable in the second scenario.

5. Parameterization in Feature File

  • A user can parameterize the gherkin steps in the feature file to obtain reusability in the file.

For Example, if a user is working on a bank application where he logs in to the application again and again. Such kind of steps could be parameterized with a different set of data and it saves time for the tester.

While writing the scenarios, the user has to define the feature file steps in such a way, so that the user can use the common functionality easily.

6. Continuous Integration – Easy to Integrate

  • Cucumber also supports working with Jenkins.

  • You can run the cucumber test execution in Jenkins and also implement the same in Jenkins slave machines.

  • The cucumber reporting plugin also provides users with an expanded view to track test scenarios.


  • Behavior Driven Development is a very smart approach in agile methodology.

  • It is always recommended to start either your development or testing using BDD, as using it gives you a platform to work independently with different technologies.

  • Cucumber is one of the best tools which helps implement the Behavior Driven Development approach in the software project.

  • This allows us to work with many technologies E.g. Java, Python, Jython, etc.

  • Cucumber is being widely used by many organizations and freelancers.

  • It also has many communities where the users can discuss their issues and can easily find solutions to their problems.

  • Cucumber language – Gherkin which uses simple plain English words- reduces the communication gap between technical teams and stakeholders and allows them to work together at the same level.

We hope this article helped you understand the basics of the BDD Framework!!

129 views0 comments

Recent Posts

See All


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page