Statement Coverage? Give example. Discuss in detail.

 Statement Coverage: 

  • This coverage is widely used for software testing and is the type of white-box testing.
  • This Technique Requires every possible statement in the code to be tested at least once.
  • It is used to calculate the total number of executed statements in the source code out of the total statements present in the source code.
  • This technique is used to design white box test cases.
  • If we want to achieve 100% statement coverage then every statement in the code should be executed at least once.
  • In this coverage technique, we focus only on true conditions.

            Statement Coverage =  (Number of executed statements/Total Number of statements) * 100
          For eg: Number of executed statements = 5
                        Total Number of statements=7
        Now  Coverage= 5/7*100=71%.
For example:
Read A
Read B
If A+B>180 THEN
IF A>130

Now we need to calculate statement coverage in this case.

Let’s draw a flow chart for this.
Statement Coverage
In statement coverage, we need to cover all nodes at least once. Hereby going through path 1A-2C-3D-4G-5H all nodes are covered.
So statement coverage in this example is 1.


  •  This Verifies what written code is expected to do and what it should not do.
  • It Confirms the quality of written code.
  • Checks the flow of different paths in the program and ensures that whether those paths are tested or not.


  • This Covers only true conditions. It cannot test conditions that are false.
  • Doesn’t understand Logical Operators.
  • It does not report whether the loops reaches its endpoint. 

In the next post, we will discuss branch coverage and path coverage. We will also discuss interview questions that can be asked during interviews. If you haven’t visited the software methodologies chapter yet, click here to read that article.

If you have any questions regarding this topic you can contact us on our email id [email protected]@sstudyhub