Test coverage
Test coverage is a measure of how much of a system's behaviour is exercised by its tests. It is routinely confused with code coverage, which counts the lines and branches a suite executes. Code coverage records what ran; test coverage asks what was actually verified, and the two numbers can diverge sharply.
The longer version
The distinction is worth holding onto because only one of the two is easy to measure. A tool can watch a suite run and report which lines it touched, and that number is code coverage. Nothing can automatically report which requirements, edge cases and failure modes the suite actually checks, which is what test coverage means. Teams end up quoting the measurable one and calling it the other.
That substitution is where the metric turns misleading. A test that calls a function and asserts nothing about the result executes every line inside it, and the coverage tool counts all of them. A suite can reach a very high figure while asserting almost nothing, and the number will keep rising as long as code is being run rather than checked.
Coverage is more useful read downwards than upwards. A high figure proves little, because it says only that code was executed. A low figure on a critical path is a real finding: it names code that nothing exercises, and it is usually faster to act on than any argument about what the total should be. Used that way the number is a search tool rather than a grade.
The failure mode is making a percentage a target. Once a threshold gates a merge, the cheapest way to meet it is to write tests over the code that is easiest to execute, which is rarely the code that most needs checking. The suite grows, the number goes up, and the risky paths are exactly as untested as they were.
Common questions
What is the difference between test coverage and code coverage?
Code coverage counts the lines, branches or functions a test suite executes, and a tool reports it automatically. Test coverage describes how much of the system's intended behaviour is actually verified, which no tool can measure. Code coverage is a proxy for test coverage, and a weak one.
What is a good test coverage percentage?
There is no figure that means a suite is good, because the metric counts execution rather than verification. A suite can execute nearly all of a codebase while asserting very little. Coverage is more useful for finding critical paths nothing touches than for setting a number the whole codebase must reach.
Can test coverage be too high?
The number itself cannot, but chasing it can be costly. Pushing toward total coverage means writing tests over trivial code, generated code and error branches that cannot occur, which adds maintenance without adding safety. The effort is usually better spent on the paths where a failure would matter.
Bug reports that arrive ready to triage.
Collect replay, console, network and browser context with the Free plan.