code coverage
Code coverage shows in percentage how much of a program's code was actually executed by automated tests.
In plain terms
Imagine visiting an apartment before buying it. If you only enter seven out of ten rooms, your visit's 'coverage' is 70 percent: you know nothing about the remaining three rooms. Code coverage measures the same for software: what percentage of the program the tests have 'entered'.
Developers write automated tests to verify whether a program works correctly. Code coverage shows which parts were not touched by any test. These are blind spots: errors can remain there unnoticed.
An important distinction is that the number only indicates what was run, not whether it was thoroughly checked. Someone who entered the room may not have noticed the mold behind the cabinet.
In the AI era, the metric has taken on a new role: when a coding agent writes code and tests, coverage is one quick feedback on how well it tested its own work.
How it works
- A measuring tool marks every line and branch of the program so it can later track which one ran.
- Automated tests are launched, while the measuring tool records which lines and decision branches the program traversed.
- At the end, it calculates the ratio: for example, if 820 out of 1000 executable lines ran, the line coverage is 82 percent. Empty lines and comments are not included.
- The report uses colors to show what was missed: typically green for tested parts and red for never-run sections.
- Many teams set a threshold, for example 80 percent: if a modification drops the metric below this, the system will not allow merging.
An everyday example
Your company orders a new customer management system, and the supplier reassures you that "our test coverage is 90 percent." This means that the tests ran through nine-tenths of the code; it does not mean that the program is 90 percent error-free. It is worth asking what is in the missing ten percent.
Who is affected
A common misconception
Limits and risks
- The figure is easy to game: one can write a test that runs the code but checks nothing about it.
- It does not show missing features: what was never written cannot be covered.
- If a percentage becomes a target in itself, the team starts chasing the metric instead of real quality, and achieving the last few percentage points can be disproportionately expensive.
- Coding agents quickly generate tests to increase coverage, but humans should still review their value, as high numbers can mask weak tests.
Similar, but not the same
- test coverage – In everyday usage, it is often a synonym for code coverage. In a stricter sense, it is a broader concept: it examines what proportion of requirements and use cases have tests, not just whether code lines have been executed.
- mutation testing – It intentionally inserts errors into the code and measures whether the tests detect them, thus examining the power of the tests, not just the affected lines.
- code quality – Code quality encompasses readability, maintainability, and security, while coverage is only one metric of this.
Related concepts
software testing, quality assurance, szoftvermetrika
line coverage, branch coverage, function coverage, condition coverage
unit test, automated testing, continuous integration, mutation testing, coding agent
A brief history
Code coverage is one of the oldest methods of systematic software testing: its first published description is linked to a 1963 article by Miller and Maloney, which appeared in the journal Communications of the ACM.
Where things stand
At the end of 2026, code coverage measurement is a standard part of software development, with most developer tools and automated checking pipelines offering it built in. As coding agents spread, machines increasingly write the tests too, which makes high coverage cheaper but the bare number less reliable.
In the news
- AI liability in insurance: AI law firm Crosby buys malpractice cover as risk migrates to cyber insuranceNov 4, 2026 · Money
- Aon and SAGE to use AI to price crop insurance more preciselyOct 29, 2026 · Money
- Anthropic flags insurance gaps and copyright risk after $1.5bn settlementOct 27, 2026 · Jog
- AI liability becomes more pressing as insurers and companies rethink coverageOct 26, 2026 · Money
- Rockwell Automation launches FactoryTalk Conductor to orchestrate AI across industrial automationOct 26, 2026 · Ipar
- Patients and experts oppose AI-based insurer customer service and prior authorizationOct 20, 2026 · Health
- Meta Advertising Week: which AI ad tools are available now and which are in testingOct 19, 2026 · Marketing
- Anthropic warns AI is months from self-replicating on smart devicesOct 13, 2026 · Agent Age
Also known as
code coverage · code coverage · test coverage · coverage metric · code coverage · test coverage · coverage · line coverage
Sources
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.