re: The tragedy of 100% code coverage VIEW POST


Thank you, I really needed this just now. Spent two hours trying to increase test coverage of some really simple thing instead of figuring out actual problems. Its really hard to find the balance, getting the percentage number up can feel super productive while its not. And then again sometimes it really is worth it.



What number were you aiming for?

Did you found any bug while trying to increase the coverage?


I am currently at 47%, not aiming for an exact number. I realized that my current testing setup wont allow for much more coverage because its too integrated. I found one typo but thats all. I think I will make the tested units smaller and mock more things to get the number up a bit.

Well, at least you found something :). Also, in a couple of months you can reflect on how useful your task was. I would love to hear about it.

There is always a tension on how big is the unit under test, how many paths the test can cover and how confident you are about your test suite.

Hard to get right, I wrote some very fuzzy and not very specific advise.


I think that the right balance comes with experience. When do you feel it is sufficient? Go with instinct, and don't over-do it.

code of conduct - report abuse