TDD is not about writing tests

This week I held a brown-bag on TDD and coding dojos in my new team. The key point was that TDD (or unit tests without TDD) should not be about writing tests. It is about documenting behavior and writing good code. As a side effect you get a test suite that make you confident your code works as intended even when changing the code. I also emphasized that we're not making the code testable for the sake of testing it, we're writing better code since there is a correlation between bad designs and designs that are difficult to test. Michael Feathers heldĀ a talk recently on this topic. At the same conference he also talked about a simple rule you should follow even if not doing TDD; Never hide a TUF in a TUC.