TDD vs. BDD: or why can’t we all just get along?
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…
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.
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.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)