DevOps Zone is brought to you in partnership with:

Dror Helper is an experienced software developer has written and designed software in various fields including video streaming, eCommerce, performance optimization and unit testing tools. He is passionate about programming best practices and all things software development, and has been a guest presenter at several user group meetings and ALT.NET events. Dror's blog can be found at where he writes about unit testing, agile methodologies, development tools, programming languages and anything else he finds interesting. Dror is a DZone MVB and is not an employee of DZone and has posted 57 posts at DZone. You can read more from them at their website. View Full User Profile

TDD vs. BDD: or why can’t we all just get along?

  • submit to reddit

I was listening to another good Hanselminuets podcast - Understanding BDD and NSpec with Matt Florence and Amir Rajan. As always it was a good and informative show. Towards the end of the show one of the interviewees (I think it was Amir) explained why BDD is much better than TDD…

Fight Night Punch Test by djclear904, on Flickr
Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic License  by djclear904


For those of you who do not know what I’m talking about – TDD is Test Driven Development (or design) and BDD is Behavior Driven Development. TDD is more “low level” talking about unit tests and integration tests and how to write code that tests code while BDD is about specifications and behaviors.

In TDD we talk about Arrange Act Assert while in BDD we have Given When Then

Each methodology has its own frameworks that help write and run tests (or specifications) that make sure our code does what it meant to do.

Am I the only one that sees a resemblance?

You might argue that one is better than the other till you blue in the face it does not change the fact that they are two sides of the same coin.

There are differences – BDD is more “high level” dealing with specifications and was intended to be used by domain experts as well as developers – although I’m yet to find the product manager that would write specifications. On the other side TDD is developer oriented and intended to be used by people who write and read code daily.

But regardless of these differences I don’t really see a reason why you should choose one over the other. I confess I use TDD and unit/integration tests in most of my projects but I do have several projects where I use both. I like the fact that I can write unit tests as well as specifications – because I need to test both. I also find myself using unit testing framework (i.e. NUnit) to write more “BDD’ish” kind of tests.

And so I don’t really understand why one is better than the other. Mainly because I prefer to use both – when possible.

And if you never tried BDD (or TDD) before I suggest you do and see for yourself.


Happy Coding…


Published at DZone with permission of Dror Helper, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Timo Lihtinen replied on Wed, 2012/03/14 - 12:14pm

I completely agree with you, I really don't like the delineation between TDD and BDD either.  I think this delineation has come to existence to show that writing your tests first isn't enough...and instead of elaborating on that and clarifying TDD, we as a community have decided to create yet another three letter acronym...BDD.

At the end of the day all I want is a valuable test, ie a test that communicates intent, tells a good story, and protects the next developer that needs to maintain the system.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.