re: The tragedy of 100% code coverage VIEW POST


This reminds me of what I read from Uncle Bob and DHH (linked from Uncle Bob's article):

Recently I've come to the conclusion that we made an Idol out of unit tests and greatly undervalue integration tests. The examples above are clearly show code that could be tested as part of the bigger picture, because in itself it doesn't mean anything: it's glue code and integration tests are supposed to check exactly that... The gluing of components together!

So the bottom line is: write a good mixture of unit and integration tests and, most of all, THINK! That's our job.


The most important thing you have pointed out is : "THINK".


THINK! is the mantra. I have been talking about that for some years now.

  • Unit tests are not tests, it is documentation
  • TDD is design driven coding (you design through code how you want your code to be)
  • You can obtain 100% code coverage without a single assert or verify :P
  • In a micro-service architecture, it is more important to write good integration tests, and only unit test complex parts or things that are not so easy to read

Unit tests is a very good tool, if used right, but if that is the only tool a developer has, he will use the unit-test hammer to solve it all...

code of conduct - report abuse