Changes between Version 8 and Version 9 of Developer/Coverage/Theory


Ignore:
Timestamp:
09/10/09 22:20:52 (15 years ago)
Author:
GlennHumphrey
Comment:

Move picture to bottom

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Coverage/Theory

    v8 v9  
    1010The ultimate goal of Code Coverage Analysis is to ensure that a test suite adequately tests a particular body of code.  In order to achieve this goal, several different coverage criteria may have to be examined.  Let's consider the following criteria:
    1111
    12  *  '''Object coverage''' - Has each line of generated assembly been executed?
    13  *  '''Statement coverage''' - Has each line of the source code been executed?
    14  *  '''Decision coverage''' (also known as Branch coverage) - Has each control structure (such as an if statement) evaluated both to true and false?
    15  *  '''Condition coverage''' - Has each boolean sub-expression evaluated both to true and false (this does not necessarily imply decision coverage)?
    16  *  '''Modified Condition/Decision Coverage|Modified Condition/Decision Coverage (MC/DC)''' - Has every condition in a decision taken on all possible outcomes at least once? Has each condition been shown to affect that decision outcome independently?
     12 *  '''Statement Coverage''' - Has each line of the source code been executed?
     13 *  '''Decision Coverage''' (also known as Branch coverage) - Has each control structure (such as an if statement) evaluated both to true and false?
     14 *  '''Condition Coverage''' - Has each boolean sub-expression evaluated both to true and false (this does not necessarily imply decision coverage)?
     15 *  '''Modified Condition/Decision Coverage (MC/DC)''' - Has every condition in a decision taken on all possible outcomes at least once? Has each condition been shown to affect that decision outcome independently?
     16 *  '''Object Coverage''' - Has each line of generated assembly been executed?
    1717
    18 [[Image(CoverageCategories.png)]]]]
    19 
    20 Each of these criteria can be used independently to analyze the code in question.  Application of any one criteria will likely improve the test suite to some degree.  But each criteria has advantages and disadvantages.  If we examine the criteria collectively, it can be seen that there are clear relationships between the different criteria as shown in the picture.  If the test suite satisfies Statement Coverage, it will partially satisfy Decision Coverage and MC/DC.  If the test suite satisfies Decision Coverage, it will completely satisfy Statement Coverage and partially satisfy MC/DC.  There is also a complexity relationship where Statement Coverage is the least complex to satisfy and MC/DC is the most complex to satisfy.
    21 
    22 <br style="clear: both" />
    23 
    24 If we consider the following example
     18In order to illustrate what is covered by each of the different criteria, consider the following simple example
    2519
    2620{{{
     
    2923}}}
    3024
    31 and its psuedo object code
     25along with its psuedo object code
    3226
    3327{{{
    3428cmp x, 0
    3529branch if FALSE to do something
     30cmp y, 0
     31branch if TRUE around do something
     32do something instructions
    3633}}}
    37 = Object Coverage =
    38 
    39 
    40 TBD
    4134= Statement Coverage =
    4235
     
    5144
    5245This is also known as [http://en.wikipedia.org/wiki/Modified_Condition/Decision_Coverage Modified Condition/Decision Coverage].
     46= Object Coverage =
     47
     48
     49TBD
     50= Criteria Relationships =
     51
     52
     53[[Image(CoverageCategories.png)]]]]
     54
     55Each of these criteria can be used independently to analyze the code in question.  Application of any one criteria will likely improve the test suite to some degree albeit at some cost.  Examination of the criteria collectively, shows that there are clear relationships between the different criteria as shown in the picture.  The completness of the test suite increases as it satifies first Statement Coverage and then Decision Coverage and finally MC/DC.  If the test suite satisfies Statement Coverage, it will partially satisfy Decision Coverage and MC/DC.  If the test suite satisfies Decision Coverage, it will completely satisfy Statement Coverage and partially satisfy MC/DC.  There is also a complexity relationship where Statement Coverage is the least complex to satisfy and MC/DC is the most complex to satisfy.
     56
     57<br style="clear: both" />