3 ms·
Another case of conflating a phenomenon and its measure. Rather than write good tests, people have gotten side-tracked by chasing magical number that may or ma
by omginternets 11y ago
Another case of conflating a phenomenon and its measure.
Rather than write good tests, people have gotten side-tracked by chasing magical number that may or may not reflect the phenomenon of interest.
Heuristics are sometimes wrong, but always fast and not fundamentally bad. Writing unit tests for high-risk code is a good heuristic, god dammit. Chasing after 100% test-coverage is pedantic, and -- I honestly think -- evidence of a development team that favors form over function.
I'll continue writing unit tests that actually test critical boundary conditions, and I will continue not to care if only 10% of my code is covered. If that 10% represents 80% of my bugs, I've won.
- knughit 11y agoWhat about the other 20% of your bugs? They don't matter?
- omginternets 11y agoHuh? Preemptively testing a subset of my code doesn't prevent me from fixing other bugs, or from writing regression tests. From the tone of your question, you'd think that 100% test coverage would fix the remaining 20%, when it clearly doesn't. I mean no disrespect, but this is what I meant when I said that unit-test coverage is a pedantic subject (which, I must again insist, is not meant to imply that you are a pedant). The bugs get fixed, they just don't get discovered/resolved with up-front unit tests alone. It ends up being more effective and more efficient to hunt them down by other means.
- chriswarbo 11y agoThe usual term for this is Goodhart's Law. From https://en.wikipedia.org/wiki/Goodhart%27s_law https://en.wikipedia.org/wiki/Goodhart%27s_law > Goodhart's law is named after the economist who originated it, Charles Goodhart. Its most popular formulation is: "When a measure becomes a target, it ceases to be a good measure."