Development QA : Software testing and Code Coverage (2/2)

This article is a continuation of a previous post which introduced the use of Code coverage to recognize test scripts imperfections. In this post we will present some complex and useful code coverage metrics.

  • Condition Coverage : (C2)
    The TRUE and the FALSE condition of each expression and sub-expression branch must be tested at least one time.


if ( (A||B) && C )
/* instruction 1 */

Following three tests may ensure the condition coverage criteria:
1-  A = TRUE and B = *  and C = FALSE
2-  A = FALSE and B = TRUE and C = TRUE
3-  A =  FALSE and B = FALSE and C = *

condition coverage

However, full condition coverage is achieved but the full decision coverage is not possible (FALSE state is not treated by code source).

  • Multiple Condition Coverage:
    Every possible combination and all brunch must be checked and tested for a condition expression. As condition coverage, this metrics cannot guaranty the decision coverage.
  • Modified condition (MC/DC or MCDC):

Each input and output in programs and each condition may influence the final decision should be invoked at least once. This metrics is the strongest criteria to evaluate the unit tests credibility.

There are a variety of tools for software code coverage, such as:  “Clover”  (for Java)  “Sonar” (for java), “Testwell CTC++” (for C/C++, Java et C#),”Xdebug” (PHP), “IBM RTRT code coverage” (for C/C++) …

Code coverage is a very useful test-related metric, but it is not a sufficient indication of quality testing. In fact total coverage can be easily reached without really testing all system requirements.

Author- Safa Achour Safa Achour


No comments yet.

Laisser un commentaire