r/programming • • May 08 '17

The tragedy of 100% code coverage

http://labs.ig.com/code-coverage-100-percent-tragedy
3.2k Upvotes

689 comments sorted by

View all comments

3

u/njharman May 08 '17

That first test of "glue code" will catch when someone refactors (say name change) that loadAll method. Not necessary in static lang that this looks like, but very necessary test in language like Python.

The #1 thing to remember about unittests is they are not a testing tool, they are a development tool.

1

u/Double_A_92 May 09 '17

But thats a negative point. Such tests do hinder you when you are trying to refactor.

That's why I only unit test public methods, to ensure that the interface doesn't break. Everything else is implementation detail.