Test Coverage

Test coverage is one of the metrics for assessing the quality of testing, which is the density of test coverage of requirements or executable code.

Let’s consider testing as “checking the correspondence between the actual and expected behavior of the program, carried out on a finite set of tests.” It is this final set of tests that will determine the test coverage:

The higher the required level of test coverage, the more tests will be selected to test the requirements under test or the executable code.
The complexity of today’s software and infrastructure has made it impossible to test with 100% test coverage. Therefore, special tools or test design techniques can be used to develop a test suite that provides a more or less high level of coverage.

There are the following approaches to evaluate and measure test coverage:

Requirements Coverage – assessment of test coverage of functional and non-functional product requirements by building traceability matrices.
Code coverage – an assessment of the coverage of the executable code by tests, by tracking parts of the software that are not tested during testing.
Test coverage based on control flow analysis – coverage assessment based on determining the paths for executing the code of a program module and creating executable test cases to cover these paths.

Differences:

The requirements coverage method is focused on verifying the compliance of a set of ongoing tests with product requirements, while code coverage analysis is focused on the completeness of testing by tests, the developed part of the product (source code), and control flow analysis is on traversing paths in a graph or model for executing the tested functions. (Control Flow Graph).

Restrictions:

The code coverage method will not reveal unrealized requirements because it does not work with the final product but with the existing source code.
Requirements coverage may leave some parts of the code unchecked because it does not consider the final implementation.