Statement Coverage Testing is a technique where test suites are designed to execute each statement at least once.
Statement Coverage Testing checks what percentage of statement is executed at least once.
It is technique of white box technique.
It tests whether each statement in the program has been executed at least once or not.
It is also called as line coverage.
Statement coverage testing covers only true conditions.
It tests the software’s internal coding structure and specially execute only those statements are true
It is used to calculate and measure the number of statement in the source code which has been executed and which is not.
Statement coverage measures with the help of -:
Statement coverage = Number of statement executed / Total number of statement * 100
It measures the level of coverage
Step-1: Read (A)
Step-2: If A>=20
Step-4: End If
Step-5: Print B
During above execution, if we provide 22 as a input then expected result should be 23. It is executed only when we provide values grater than or equal to 20 else not executes.
Advantage of statement coverage-:
– Measures quality of code written
– Check flow of different path
– Ability to identify which block of code not been executed
Disadvantage of statement coverage -:
– Test only true conditions
– Does not report whether it reaches to the terminations
– Shows 100% statement coverage even bug is there
– Have to design test cases to execute specific statement