Hacker News new | ask | show | jobs
by josepot 2475 days ago
Test coverage is a very dangerous metric. IMO it will only be useful the day that we find a way to not take into account those tests that are testing implementation details. Every time that I see a high number being enforced, the end result is always a disaster: lots of poor quality tests that are only there in order to bump up that metric. Those tests are poison: they don't aim to test correctness, they make refactors/improvements a PITA, they just lock you down to a concrete implementation and they don't even give you any guarantees that your code works correctly.
1 comments

Bingo, this *1000.

Your team ends up spending half their time writing painful depressing tests that are bad afterthoughts. Generally with TONS of mocks and little real meaning.

The other half of the time is spent editing the tightly coupled mocks/tests when you refactor the real code. Bad tests can be a liability, not an asset.