4 ms·
> the quickest way to get high code coverage numbers apochryphal tale of test coverage + Goodhart's law: Team is responsible for a software component that's t
by shoo 3y ago
> the quickest way to get high code coverage numbers
apochryphal tale of test coverage + Goodhart's law:
Team is responsible for a software component that's two-thirds gnarly driver code that's impossible to unit test, and one third trivial stuff that's easy to unit test. Team has 33% unit test coverage.
Test coverage becomes an organisational KPI. Teams must hit at least 80% statement coverage. Oh no!
Team re-architects their component & adds several abstraction layers that wrap the gnarly driver code, that don't serve any functional purpose. Abstraction layers involve many lines of code, but are elegantly designed so they are easy to test. Now the codebase is 20% gnarly driver code that's impossible to unit test for, 10% trivial stuff that's easy to unit test, and 70% layers of unnecessary nonsense that's easy to unit test. 80% statement coverage target achieved! Raises and promos for everyone!
- rexpop 3y agoI find it hard to imagine anyone stupid and scrupulous enough to go that route when the honorable and beneficial option is to a) push back on arbitrary metrics and b) strive to extract maximal value out of testing practices in earnest.
- troupo 3y ago> when the honorable and beneficial option is to a) push back on arbitrary metrics Depends on the company. Sometimes it's just mandated from above and you have no power
- rexpop 3y agoOf course it's mandated from above, but you always have power. There's no such thing as a powerless employee. That's the very basis of a free society. "No power" is another word for "slavery." Or maybe your point is that it's a matter of degree? Sometimes employees' have already stretched their leverage thin across other, higher priority stipulations such as free coffee, and parking privileges.
- troupo 3y ago> but you always have power. Ah yes. I can tell my manager who may tell their manager who will just say "it's company policy". If I'm not on a visa I can probably quit and go to. different company, but that's often all the power that you have.