On an internal email discussion, someone asked for some help applying Code Coverage tools to evaluate their Unit Tests.  So, I blog:

Is it really important to you to get Code Coverage on your TDD’d code?


From http://c2.com/cgi/wiki?UnitTest:


Are we testing too much? The purpose of unit testing is to increase developer mobility. It is not to verify the correctness of your program. Are you testing privates? Are you testing simple accessors? Are you trying to make unit tests perform 100% code coverage? These are all practices that may have some value, but also may serve to defeat the real purpose of unit tests.


When I’m doing TDD, I would look at Code Coverage as a way of measuring my TDD skills, not of my unit test quality.  That is, I would look at the <100% results & try to under why I missed them, to see if I can learn something that would make me better at TDD. 


There is no rule that TDD must generate 100% coverage, and there is no guarantee that 100% coverage means that you’ve succeeded with TDD.


The main way I measure the quality of my Unit Tests is: