Code Coverage Testing

Code Coverage testing is a process of measuring percentage of source code tested or covered or executed by tester and which code is not, if percentage is low (not 100%), then some additional test cases can be added to increase code coverage.

Code Coverage measurement tools assess the percentage of executable code that has been exercised.

It is related to white box testing

It require technical knowledge to access the percentage of code coverage.

Coverage can be measured at unit testing, integration testing, system testing and acceptance testing levels.

Code coverage testing is used to assess the quality of software application by exercising which source code is executing while application is running.

In code coverage structural elements can be identified using a tool and support for measure statement and decision outcomes.

It can be measured by -:

Code Coverage =Number of coverage item exercised / Total number of coverage items   * 100

It increase productivity and efficiency by exercise the user requirement

Example -:
Step-1: Read (A)
Step-2: If A>10 then
Step-3: B=A+1
Step-4: Else B=A-1
Step-5: End If
Step-6: Print B
During this execution, code coverage satisfies all transactions and requirement after exercising the code. If we will provide 11 as an input then expected outcomes should be 12 and 9 as an input then expected outcomes should be 8

Different code coverage criteria are
– Functional coverage
– Statement coverage
– Decision coverage
– Condition coverage
– Path coverage

Goal of code coverage
– Helps to improve quality of software
– To measure percentage of requirement

Drawback of code coverage
It measures coverage only what has been written

Leave a Reply