test coverage
noun
Test coverage measures which parts of the code execute during automated tests. It can count lines, functions and branches, among other things.
Adding tests increased the test coverage of the price calculation.
Test coverage shows which parts of a Glossary · In briefcodebaseA codebase is the collection of source code used to build and maintain a software product or component.Read more run during automated tests. A tool records the lines, functions or branches executed and reports counts or percentages. This helps identify code not yet exercised by a test.
What exactly is measured?
The chosen metric determines what a coverage percentage means. Line or statement coverage checks whether individual instructions ran. Function coverage counts which functions were called. Branch coverage checks whether different outcomes of a condition were exercised, such as both the yes and no paths of a check.
Teams can measure coverage for Glossary · In briefunit testA unit test is an automated test of a small, defined software component, usually isolated from external systems.Read more, Glossary · In briefintegration testAn integration test checks whether several parts of a software system work together correctly, focusing on their communication and the data they exchange.Read more and Glossary · In briefend-to-end testAn end-to-end test checks whether a complete user journey through an application works, including the components and systems that must work together.Read more. The useful combination depends on the application and the risks the team wants to cover.
What does a high percentage mean?
High test coverage means much of the code ran during tests. It does not prove that those tests checked the correct outcomes. A test can reach a line without detecting a bug in it. Important situations can also be missing while the percentage remains high.
Test coverage mainly provides clues to missing tests. Teams can focus on calculations, access controls and other code where errors have significant consequences. The quality of checks and chosen test cases matters more than a single overall target percentage.