QA glossary
What is test coverage?
Test coverage is a measure of how much of a product the tests have exercised. It can be counted against the code, against the requirements or against risks and platforms. A high figure shows what was run, never that what was run was checked well.
An example from QA practice
A refund function shows 100% line coverage because a test calls it. The test only asserts that no error was thrown. The refund is calculated on the wrong amount, and no test notices, because nothing compared the amount with the expected one. The coverage report was green and the defect shipped.
Kinds of coverage
Teams use the word for several different measures, so ask which one is meant:
- Code coverage: the share of statements or branches the tests execute. Tools report it automatically.
- Requirements coverage: how many requirements have at least one test. A traceability matrix is the usual way to show it.
- Risk coverage: whether the areas that would hurt most if they failed have the most testing.
- Platform coverage: which browsers, devices and operating systems were tested.
Why a target number misleads
Set a target of 90% and people write tests that run lines, not tests that check results. Use coverage as a map of what has never been exercised, and read the gaps, not the total. Low coverage in a payment module matters more than low coverage in a settings page, and 100% of the wrong things is still wrong.
Common questions
How do you check that tests really check something, and do not only run code?
Mutation testing changes the code on purpose, for example by flipping a comparison, and reruns the tests. If the tests still pass, they either never ran that line or ran it without checking its result. The share of changes the tests catch says more about the strength of the tests than line coverage does.
What is the difference between statement coverage and branch coverage?
Statement coverage is the share of executable statements the tests ran. Branch coverage is the share of branches they took, which for an if means both the true and the false outcome of the decision. A test can run every statement and never take the false outcome of an if with no else, so branch coverage is the stricter measure.
Where should a coverage threshold be set in a pipeline?
Set it on new and changed code instead of the whole codebase. A gate on the change stops fresh code arriving untested without forcing a rewrite of old code, and it moves with the project. Pick a level the team agrees is reasonable, and review the files that fall below it.
How BetterQA does it
BugBoard links test cases to Jira tickets to report ticket coverage, and it can analyse a test suite for missing cases such as edge cases and error states. Our engineers use that list to decide what to add next, rather than chasing a percentage.
Related terms
Testing designed from the structure of the code, where code coverage comes from.