tags:

views:

305

answers:

4

I see many developers disagree on which style of test to use while starting a new project. I'd like to know why you choose this particular style over the other.

+3  A: 

I usually use the outside-in principle. Whether you will call that TDD or BDD is of less importance to me.

What this means is that I start at the most significant part of the feature that I want to implement, and work from there. This is often the User Interface, but it doesn't have to be. Sometimes the most significant area is a service operation or a background process, and then I start there.

I use Test Doubles to define how the classes I define interact with its environment, and then implement more and more of the abstractions defined by these Test Doubles as I implement the feature.

So I guess you could say that I start out in a BDD mindset, and then move more and more towards TDD as I work my way down the call stack, so to speak.

Mark Seemann
+6  A: 

BDD and TDD are not excluding each other. I think, BDD addresses more the software development as a whole, beginning from requirement analysis. TDD is purely related to implementation and is actually a personal work technique of a developer.

Stefan Steinegger
That's correct. BDD is meant to include the domain experts (which need not be technically minded at all) in the development process, so as to stick closely to the business requirements. TDD is very technical, and only really relevant to software developers themselves.
Matthias
+2  A: 

I learned to do TDD in a BDD style. Its all really a matter of how you do your thinking.
Many people have made the mistake thinking that TDD was about testing. Thus BDD was created' to minimise confusion by emphasising behavior over testing.

Jeff Waltzer
+3  A: 

TDD v BDD is really a state of mind. The way I see it is, in TDD a lot of emphasis is on what should this value be at this point, where as I see BDD, which will also test values of course and how we got them, as being more of, when this is in this state, what should this part of my application do.

railsninja