top of page
Writer's picturePragyan Patnaik

An Introduction to Behavior Driven Development Framework And Implementation of Gherkin in BDD.

Behavior Driven Development (BDD) framework is a software development process that is an offshoot of Test Driven Development (TDD) framework. BDD is an agile testing methodology. It is the process of development, based on test-driven development and domain-driven, object-oriented analysis. However, it can be organized with traditional testing as well. Behavior-driven development (BDD) is a more refined and business value derived approach for test-driven development, to ensure we are building the right product with no features or tests that don't add business value. The following diagram represents what BDD brings in addition to the TDD approach. It is a more feature-centric development:




Understanding Behavior Driven Development

While there will always be some gaps in meeting expectations between what a stakeholder wants and what is delivered, it is important to narrow down this gap as much as possible. One way to achieve this would be for the development and business teams to collaborate on a common language and have a suite of automated tests that when run, does what the stakeholder wants. These are hence called acceptance tests because the stakeholder finds them acceptable.

However, invariably, automated tests fail at the time of writing because no source code (and hence the AUT) exists, however it brings the stakeholders and developers on the same page about `what’ has to be done [Acceptance tests capture the behavior of the application as seen from outside i.e. as a user/stakeholder experiences it. This is different from unit tests, that capture whether you build the thing right, not necessarily build the right thing]. It is to resolve these kinds of problems that BDD exists.

Advantages of BDD and BDT

Coordinates between shareholders and delivery teams with different views on the same page but have a common expectation. BDD begins with the business goal.

The goal of BDT is a business readable and domain-specific language that allows you to describe the behavior of a system without putting details on how that behavior is developed.

In BDT, tests in the form of simple text descriptions/features with scenarios are typically written before anything else and checked by the non-technical shareholders.

Behavior Driven Script Development

This behavior driven script development cooperates and comes up with a good and clear set of Acceptance Criteria which is defined by a language called Gherkin.

Gherkin Keywords:

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

Feature: BDD implementation using Gherkin

Scenario: Login to G-mail

Given User is navigating to G-mail Login Page

When User need to enter username as "Username" followed by password as "Password"

Then User is successfully navigated to the G-mail

Advantages Of BDD Framework

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.

Due to its easy concept of layman text in the form of a feature file allows the stakeholders of technical resources to write the scenarios in Gherkin language using the user stories. The compatibility of the plain text helps to gain maximum coverage on testing.

Courtesy: Infosupport


178 views

Recent Posts

See All
bottom of page