Do you write tests first in TDD?

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

  1. Not writing tests first
  2. Repeat point number 1

 

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s