Search code examples
tddbdd

What are effective techniques to break down TDD from a business level to the unit level?


I totally get TDD at a low level but I see very little information in actually applying these techniques to a large, complex project. Applying it to a single function/class is easy, but when I have to think about hundreds of components interacting with each other, I am a bit lost.

Currently I am writing user stories, then building features and scenarios but that's as far as I have gotten.

  • How can I know if I'm writing good user stories (aren't too broad, aren't irrelevant)?
  • Is it good practice to use BDD on top of TDD?
  • If so do I still follow the TDD flow where I write a scenario (which is essentially an integration test in my case), and then let that fail until every unit test is passing underneath it?
  • If not what are effective techniques to break down the testing from a business level to the unit level?

Solution

  • For user stories, you might want to read the books by Gojko Adzik, expecially Fifty Quick Ideas To Improve User Stories.

    Yes, it is smart to use BDD as the "outer loop" of TDD.

    One way of doing it is the one you outlined. You might want to read Growing Object-Oriented Software Guided by Tests, which gives you a much in-depth description of the process of going from high-level end-to-end tests to granular unit tests.

    Another way to learn is to look at the first video from Sandro Mancuso and Uncle Bob in the series where they compare the so-called London and Detroit schools of TDD.