Why Coverage Isn’t Everything: Rethinking Your Testing Approach

Greg L. Turnquist
3 min readMar 5, 2023

Do you take pride in high coverage scores? Do you compare coverage percentages with colleagues to see who is doing better?

This is probably wrong.

Unequivocally, undeniably, ecumenically wrong.

And probably time to rethink your approach.

Coverage reports are useful, but they aren’t everything. The goal of testing is not just to have high coverage scores, but to ensure that the code works as expected in real-world scenarios.

What does this mean exactly?

Those that get overfocused on coverage reports are probably sacrificing test quality to achieve those numbers.

And sacrificing test quality for the sake of coverage is a recipe for disaster.

Coverage reports can give us insights into what is being exercised and what is not, but they don’t tell the whole story. Simply because a line of code is being exercised doesn’t mean it is doing what it’s supposed to do.

How can we solve this?

We need not only generate the coverage reports, but must also analyze what they mean.

We need to analyze what is being covered and how well it is being tested. For instance, if a module has 70% coverage, it…

--

--

Greg L. Turnquist

Sr. Staff Technical Content Engineer at CockroachDB • YouTube Content Creator at https://youtube.com/@ProCoderIO • Best-Selling Author • Coffee Lover