Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

test based

Test Driven Development vs. Behavior Driven Development

Educative Answers Team

Test-Driven Development (TDD) and Behavior Driven Development (BDD) are two types of software development techniques. Let’s look at the features they have in common​ and how they differ.

svg viewer

Test Driven Development

In TDD, test cases are written before the code underlying those test cases is written. The methodology for TDD is roughly as follows:

  1. A test case is written.
  2. The test case is run on the current developed code.
  3. When the test case fails, code is developed to pass that test case.
  4. Once a working code has been developed, the development team refactors it into existing code (as a deliverable).

Test scripts are written in programming languages and are therefore difficult for a business analyst or customer to understand and verify.

Behavior Driven Development

BDD is focused on the business behaviors behind the code. The user’s behavior is defined before any automated test cases or functional code is written. Since the behavior is defined in plain English (unlike programming languages in TDD), BDD supports a team-centric workflow where the stakeholders and clients are also involved in the project. The workflow in BDD has been roughly laid out below:

  1. The behavior of a user is defined in simple English.
  2. The English words are then converted into automated scripts that run against functional code.
  3. The development team develops code to pass the test case and refactors and organizes the code to produce a fully tested deliverable.


While TDD focuses on the implementation of functionality, BDD focuses on the behavior of the application for the end-user. This methodology gels well with Agile and pushes developers to think from the point-of-view of their users.

In the end, the choice of BDD, TDD, or a hybrid of both, depends on the project itself. For systems that rely heavily on the user (i.e., websites),​ BDD would be a better fit. However, for systems that are more concerned with functionality, ​TDD is the better choice.


test based
Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring