I am quite surprised how some technical terms easily lose their meaning over time. TDD (Test driven development) is one of them. I repeatedly meet people who do TDD at their work and when I say I also do TDD at work the next question most of the times I get asked is “Do you write tests first”? Stumped! TDD is always about write a test first and then write its code, test code is not a different citizen from production code while under development.
A few years ago if I had asked an interview candidate “Do you write your unit tests before writing your code if you are following TDD?” the chances are high that the candidate gets offended but now I am given a reply “I tried, but it is hard to do it; so we write tests after the coding is done to keep the coverage at 80”. So TDD has evolved to have a meaning of having 80%(or any other easy number) line coverage than a way of making sure to get a good low level design and have enough safety nets in place.
You are not following TDD if
- Not writing tests first
- Repeat point number 1