1.

What is BDD (Behavior-driven development)?

Answer»

BDD is an extension of TDD. The major DIFFERENCE between TDD and BDD are:

  • Tests are written in plain descriptive English type grammar
  • Tests are explained as the behavior of an application and are more user-focused
  • Using examples to clarify requirements

This difference brings in the need to have a language which can define, in an understandable format.

Features of BDD

  • Shifting from thinking in “tests” to thinking in “behavior”
  • Collaboration between BUSINESS stakeholders, Business Analysts, QA Team and developers
  • Ubiquitous language, it is easy to describe
  • Driven by Business Value
  • Extends Test Driven Development (TDD) by utilizing natural language that non-technical stakeholders can understand
  • BDD frameworks such as Cucumber or JBehave are an enabler, acting as a “bridge” between Business & Technical Language

Example:

Scenario: Duplicate email Where someone tries to create an account for an email address that already exists.

Given I have chosen to sign up But I ENTER an email address that has already registered Then I should be told that the email is already registered And I should be offered the option to recover my password

Now after a look at the above example code, anybody can understand the workings of the test and what it is intended to do. It gives an unexpected powerful impact by enabling PEOPLE to visualize the system before it has been built. Any of the business users would read and understand the test and able to give you the feedback that whether it reflects their understanding of what the system should do, and it can even lead to thinking of other scenarios that need to be considered too.

Advantages of BDD:

  • Writing BDD tests in an omnipresent language, a language structured around the domain model and widely used by all team members comprising of developers, testers, BAs, and customers.
  • Connecting technical with nontechnical members of a software team.
  • Allowing direct interaction with the developer’s code, but BDD tests are written in a language which can also be made out by business stakeholders.
  •  Last but not least, acceptance tests can be executed automatically, while it is performed MANUALLY by business stakeholders.


Discussion

No Comment Found