What is exact difference between TDD and BDD? Could you please briefly explain them to me?


6 Answers 6


TDD (Test Driven Development)

  • Who's involved: Developers
  • Summary: Developers start writing code by first defining tests (in general unit tests). It could sound strange, but this practically guarantees a high code-coverage and in particular it forces developers to think about what they are doing. TDD can be applied to any kind of software.

BDD (Behaviour Driven Development)

  • Who's involved: Anyone (in theory)
  • Summary: It allows defining a priori the expected behaviours of a software. There are several tools, like Cucumber, for writing "Behaviours".

    You should write the expected behaviour using a predefined syntax that will be translated into code by developers and into test by QA. BDD cannot be applied to any kind of software.


Both are a form of test driven development, since you write the tests upfront. The main difference is that TDD tests are technical tests often unit-tests created during developing of a feature and are written just before you implement a part of the feature in the code-base. Where BDD tests are often written before the coding starts and are human readable and anyone should be able to understand what they test. BDD tests are used as Specification by Example.

But its a bit more complex than that as BDD frameworks like JBehave can also be used to write unit-tests, but also for end-2-end integration tests. And nothing is really forcing you to make the tests readable by non developers.

There is also a third term ATDD (Acceptance test-driven development) which is how BDD was called before the BDD era. This makes the difference between the both a little bit more clear.

Suggested reads are

Personally I think we should find another name for TDD which makes it clear that its a cycle for writing unit-tests, because now its so broad that any tests defined before the coding could be called a form of TDD.

Hope I not confuse you more, but the main difference is technical tests testing the working of methods (TDD) vs human readable tests describing the behavior (BDD).


Adding my view points here.

TL;DR : BDD focuses on the behavioural aspect of the system rather than the implementation aspect of the system that TDD focuses on.

BDD gives a clearer understanding as to what the system should do from the perspective of the developer and the customer. BDD allows both the developer and the customer to work together to on requirements analysis that is contained within the source code of the system.

TDD gives the developer an understanding of what the system should do.TDD encourages coders/designers to design as little as needed. Tests in TDD help the programmer see clearly what to build and stop when they've built it.

TDD implies that you must test every method in your application (well, not every method, but at least a good coverage of them) asking them -

"When I execute you with this parameters what effects do you have?".

BDD implies that you must test every user behaviour (again, "every" is the best situation, but sometimes you can't test every behaviour) using a different language:

"When the user goes into this page, fill this form and send it what can they see after?"

Notice that in TDD what you ask is "what is the application doing?" and in BDD you are asking "What can see the user?"

In my understanding,TDD is more exhaustive, but has a problem- it is more dependent on the implementation.

If you change the name of a class, method, what a method returns, etc. you must change the test.

BDD is more pragmatic- I don't care about the internal implementation but about what the user can do and can see.

If you change the internal implementation (you change the webservices you are using, the name of a class or the algorithm) but the user still see it's working you are Ok.

Here's to hoping TDD vs BDD wars don't start again :)

Adding some useful TDD vs BDD link from SO :

  1. Link 1
  2. Link 2
  3. Link 3
  4. Link 4

Test Driven Development

  1. TDD is the technical team that all cases of unit tests will be written
  2. TDD is installed for testing
  3. TDD encourages technicians to design as little as necessary
  4. TDD help the programmer clearly see what to build and when to stop stop built.
  5. TDD focuses aspect of the implementation of the system
  6. TDD methodology is Inside-Out, TDD is more like a development tool for building testable, modular architecture.
  7. Tdd = Refactoring + TFD Behavior Driven Development then BDD is to take care of the functional aspects thereof. the average can be understood by non-developers too
  8. BDD applies the narrative format (Since when, then format) BDD encourages everyone to build as little as necessary.
  9. The act of writing examples BDD style gives everyone on the project a clear understanding of what it means to a function and when to stop its construction.
  10. BDD focuses on the aspect of system behavior is a BDD methodology outside inward. It starts out by identifying the business results, and drill down into the feature set that will achieve those based outcomes.each is captured as a "story."
  11. BDD = TDD + incremental analysis of needs

This blog I found gives a good understanding the difference between TDD and BDD - https://onpathtesting.com/why-go-for-behavior-driven-development-bdd/

  • Please add a little more description on how this explains the difference. Link only answers are not the best way to answer and are frowned upon. Feb 26, 2016 at 6:50

I know I am 5 years late :-( but I see this question relevant even after 5 years as this is still an open question for many. I also think that the answers given till date is not comprehensive enough to exactly explain the differences.

Here are the 5 main differences between TDD and BDD:

  1. TDD is implemented by Developers and BDD is implemented through collaboration between cross functional members of the team. Collaboration is the key for BDD to be successful

  2. The test scenarios in TDD is implemented using a programming language. BDDs are written in Natural language

  3. Developers responsibility to create and maintain TDD artifacts. Whereas BDD Artifacts are developed through collaboration and maintained by entire team

  4. TDD is Black Box testing and BDD is White Box testing

  5. TDDs are written for individual functions. BDDs are generally written for end to end behavior

I have written a comprehensive article, explaining these differences using examples and code. Link to the article is given below: https://blog.nocodebdd.com/bdd-vs-tdd/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.