Richard Bucker

TDD is putting the cart before the horse

Posted at — May 24, 2012

Can you imagine the Budweiser Clydesdales trying to push their beer wagon? Personally I do not see it happening any time soon. So as I think about TDD (test driven development) that’s exactly what I envision.When programmers develop code there are a number of things that they should be doing… not the least of which is functional tests and regression testing. Now whether these tests are actually written after the function is written or not can be debated to some extent. What cannot be debated is just how much TDD is implemented before actual implementation of the target application, module or function.I recently heard a story about a CTO who demanded that the entire suite of TDD test cases be implemented before the first line of code was written for the target application. This was clearly an unrealistic expectation and probably just abuse of power.PS: consider dependency injection if you can. It makes testing easier without having to backdoor any sort of state or dependency.