Code Coverage and Its Limitations
What code coverage metrics actually measure (lines/branches executed by tests), and why high coverage numbers don't guarantee genuinely good tests.
Code coverage measures what proportion of a codebase's lines, branches, functions, or statements were actually executed at least once while running a test suite, typically reported as a percentage, and while it's a genuinely useful signal for spotting completely untested code, it's also one of the most commonly misunderstood and over-relied-upon metrics in testing, which is why interviewers like to probe whether you understand its real limitations rather than just how to generate a coverage report.
Code coverage is like tracking what percentage of a building's rooms someone physically walked through during a fire inspection — 100% room coverage tells you every room was visited at least once, but says absolutely nothing about whether the inspector actually checked each room's smoke detectors properly or just walked in, glanced around without looking at anything specific, and walked back out.