Code coverage, also known as test coverage, measures the proportion of your code exercised by automated tests.
Code coverage tools are specific to particular programming languages. They use a range of criteria to measure coverage, including the number of code lines, methods or functions, branches and conditions. You can use a code coverage tool to identify your codebase parts that are not currently covered by automated tests.
Monitoring code coverage metrics help ensure that you’re maintaining a sufficient level of automated testing. If code coverage starts to decrease, it could be a sign that you’re not treating automated tests as an essential element of writing new code.
However, while code coverage tells you how much of your code is covered by tests, it does not tell you how effective those tests are or whether they address all failure modes. Use code coverage in conjunction with other metrics to understand the effectiveness of your automated testing regime.