3

I'm a little bit confused about BDD. I'm doing TDD currently.

My question is whether BDD is complementary to TDD or it's a whole new thing and my team should do both TDD and BDD? Or is it enough to do just one or the other?

feketegy
  • 221
  • 1
  • 6
  • 1
    Is TDD working for you? Do you have concerns about product quality? Schedule? Communication with stakeholders? If yes, which ones are most important? If development is going well, why do you want to change? – Thomas Owens Sep 13 '12 at 14:15
  • RDD _ has pieces of both and is very effective ))) – superM Sep 13 '12 at 14:15
  • 5
    Could be good if you elaborated what the terms actually mean, so people new to the subject could perhaps gain some insight. – zxcdw Sep 13 '12 at 14:20

3 Answers3

7

By definition, BDD is based upon TDD and is a refinement / extension / specialization of the latter.

is it enough to do just one or the other?

According to the above, you can't do BDD without TDD.

In general, there is no one-size-fits-all answer: do what suits your team and your project the best. Feel free to experiment with new ideas, pick what works and drop or change what doesn't.

Moreover, this is not an all or nothing question: you can do TDD enhanced with specific ideas from BDD which you feel are a valuable addition to your process. For example, I adapted the "should" naming convention of unit tests in my practice because I find it makes my unit tests more readable and expressive.

Péter Török
  • 46,427
  • 16
  • 160
  • 185
  • So basically one does BDD it doesn't necessarily has to do TDD in the traditional sense where you set up a tool for TDD and you set up another tool for BDD? – feketegy Sep 13 '12 at 18:38
  • @feketegy, I don't think you need double tooling. I am not familiar with BDD tools but from what I understand, these either complement TDD tools or take the job over completely. And there are things and practices (like naming) which don't require tooling changes at all. – Péter Török Sep 13 '12 at 18:45
  • To be more specific, in the PHP world if I use PHPSpec or Behat (as BDD framework) is enaough, or I need to use PHPUnit as well too? – feketegy Sep 15 '12 at 16:27
2

This discussion has been very active lately in the software development community. For me at least BDD has caused a mind shift, a shift that emphasizes software behavior over implementation. Bringing the ubiquitous language in all parts of the development process is of great benefit and BDD teaches that. BDD has a broader audience tester, managers, analysts.

Rachel Davis has a nice explanation of BDD="Shared understanding by discussing examples". So describe what you want the system to do and talk about some examples. If you want to read more on this topic check out this discussion on one of the father's of BDD blog: BDD is like TDD if ...

Vadim
  • 547
  • 3
  • 5
0

I think the BDD/TDD systems have undergone a change in what they were originally about, but nevertheless, they still have their uses and are complementary. TDDs via unit tests are very popular today, but adding BDD via something like Cucumber allows you to drive your components in a more user-focussed way. I think of them today as TDD being ways to test the objects, and BDD to test the applications/components.

You can still do BDD using Unit test tools (as I think it was intended) by writing your tests and then creating objects to fulfill them (ie not just as a method level granularity), but with 'story based' testing tools, you can create higher-level tests that are a little more evolved than using unit-test tooling.

gbjbaanb
  • 48,354
  • 6
  • 102
  • 172