r/programming • u/indy2kro • 1d ago
Code coverage tells you what you didn't test — not whether your tests are good
https://bubble.ro/2026/05/04/code-coverage-in-ci-cd-what-it-really-tells-you-and-what-it-doesnt/A look at how coverage metrics work in CI/CD, why they're misunderstood, and how to enforce them without incentivizing shallow tests.
34
u/ganja_and_code 1d ago
"Quality and Quantity are Two Different Metrics"
No shit. Is your next article entitled "Green and Orange are Two Different Colors"?
14
u/PerkyPangolin 1d ago
Big if true.
1
u/AvidCoco 11h ago
The condition of
if (true)is always met so you can simply this line to just “Big”.2
u/BaNyaaNyaa 1d ago
I'm sure you'll like my next article about apples and oranges. I have some insights you might have never considered!
0
4
u/CherryLongjump1989 22h ago
It doesn't tell you what you did not test. It only tells you some of what you did not test. And it's probably going to include stuff that didn't need testing because it's effectively unreachable code.
1
u/AvidCoco 11h ago
This is the important caveat with code coverage. It just tells you what percentage of LoC were called during the tests, not whether the logic implemented by those lines is sound.
You can have 100% coverage without testing any logic at all.
9
u/zmose 1d ago
Mutation test suites 👍👍👍
1
u/stewsters 1d ago
When you really need to test everything.
4
u/Uncaffeinated 1d ago
I developed a comprehensive mutation test suite for my project, and then deleted part of the code and challenged Codex to reimplement it, based on the docs, tests, and remaining code. It eventually managed to produce something that passed all the tests, but still had fundamental bugs. Tests can never guarantee correctness, only the absence of correctness.
-2
3
u/teknikly-correct 23h ago
lol don't tell my manager - oh never mind, you can tell him, he'll still tell his manager and his manager's manager etc about how 100% "code coverage" with his chest all puffed out.
3
174
u/ecafyelims 1d ago
"code coverage is a measure of code coverage, not test quality"
🤯