BDD or TDD? Which one do you prefer? and why?

I can see that many developers disagree on which test style to use when starting a new project. I would like to know why you choose this style over the other.

+2


source to share


4 answers


TDD v BDD is truly a state of mind. The way I see it, TDD places a lot of emphasis on what should be in that value at this stage, where I see BDD that will also check the values ​​and how we got them, how more when it is in this state, what is this part of my application supposed to do.



+3


source


BDD and TDD are not mutually exclusive. I think BDD refers more to software development in general, starting with requirements analysis. TDD is purely implementation related and is actually a personal way of working for a developer.



+5


source


I usually use the out principle . If you name that TDD or BDD is less important to me.

This means that I start with the most significant part of the function that I want to implement and work from there. This is often the user interface, but it is not required. Sometimes the most important area is a maintenance operation or a background process, and then I start there.

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

So, I think you could say that I start thinking in BDD style and then move more and more towards TDD as I, for example, work my way up to the call table.

+4


source


I learned how to do TDD in the BDD style. It's all really a matter of how you think. A lot of people are wrong in thinking TDD is all about testing. Thus, BDD was created 'to minimize confusion by highlighting testing behavior.

+2


source







All Articles