Last Updated : 23 Jul, 2025
Every Software Developer follows the Software Development Life Cycle (SDLC) for the development of any software application. Testing is one of the important phases that is performed to check whether the developed software application is fulfilling the requirements or not.
Different types of software testing are there which are performed based on various metrics/testing parameters.
What is Code Coverage?Code Coverage is a metric used in Software Testing that quantifies the extent to which the source code of a program is tested. It measures the percentage of code executed by the test suite, helping developers identify untested parts of an application.
As we know at last of the development each client wants a quality software product as well and the developer team is also responsible for delivering a quality software product to the customer/client. Where this quality refers to the product’s performance, functionalities, behavior, correctness, reliability, effectiveness, security, and maintainability. Where Code Coverage metric helps in determining the performance and quality aspects of any software. The formula to calculate code coverage is
Code Coverage = (Number of lines of code executed)/(Total Number of lines of code in a system component) * 100Code Coverage Criteria
To perform code coverage analysis various criteria are taken into consideration. These are the major methods/criteria which are considered.
1. Statement Coverage/Block coverageThe number of statements that have been successfully executed in the program source code.
Statement Coverage = (Number of statements executed)/(Total Number of statements)*100.2. Decision Coverage/Branch Coverage
The number of decision control structures that have been successfully executed in the program source code.
Decision Coverage = (Number of decision/branch outcomes exercised)/(Total number of decision outcomes in the source code)*100.3. Function coverage
The number of functions that are called and executed at least once in the source code.
Function Coverage = (Number of functions called)/(Total number of function)*100.4. Condition Coverage/Expression Coverage
The number of Boolean condition/expression statements executed in the conditional statement.
Condition Coverage =(Number of executed operands)/(Total Number of Operands)*100.Types of code coverage
Understanding the different types of code coverage helps in ensuring comprehensive testing of your software. Here are the main types:
Types of code coverage 1. Statement Coverageif (A && B)
, both A and B should be tested for true and false values.Each type of code coverage focuses on different aspects of the code, helping to ensure thorough testing and improving overall software quality.
Below are a few important code coverage tools
Code coverage is a crucial metric in software testing, providing insights into the extent to which the source code is tested. It helps developers identify untested parts of an application, ensuring the performance, functionality, and reliability of the software. Various types of code coverage, including statement, branch, function, condition, path, line, and loop coverage, offer comprehensive testing approaches to enhance software quality. By using code coverage tools like JaCoCo, Cobertura, and SonarQube, teams can efficiently maintain their code base, improve test suite quality, and ensure thorough verification of the software.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4