Each and every software consists of numerous statements. In terms of software programming, a statement is an instruction which is written in the programming language, that tells the computer what action needs to be executed. The main purpose of this article is to help you understand a little bit about a software testing technique known as the Statement Coverage.
Statement Coverage is a metric that is used to measure and quantify the total number of statements that have been successfully executed in the source code. This metric is always presented as a percentage. When the coverage is 100%, it means that every statement has been executed once. Sometimes, Statement Coverage is also known as Line Coverage or segment Coverage. It is a white box testing technique whose purpose is to confirm that each statement in the source code is executed at least once.
Mathematically, Statement Coverage can be represented by the formula:
Statement Coverage Percentage = (Total no. of statements executed / Total no. of statements) * 100
The main advantages of Statement Coverage are as mentioned below:
The prime disadvantages of Statement Coverage are:
Statement Coverage identifies those statements in any given method that have been executed. By doing so it is able to recognize those chunks or blocks of code that failed to perform their designated task. Ultimately, identification of these blockages is the main job of Statement Coverage. The higher the Statement Coverage number the better is the quality of the written code. The best part of this testing technique is that it can be conducted by the code developers themselves and that to continuously as each subsequent statement is written.
Advertisement: