Changes between Version 11 and Version 12 of Developer/Coverage/Theory


Ignore:
Timestamp:
Sep 12, 2009, 2:02:56 AM (10 years ago)
Author:
GlennHumphrey
Comment:

Some rearrangement and additional text

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Coverage/Theory

    v11 v12  
    2121
    2222
    23 Decision Coverage requires that each control structure evaluate to both TRUE and FALSE.  This is a pretty good criteria because it generally ensures that both the TRUE and FALSE paths of an expression are covered.  However, expressions without an else alternative can be a problem because
     23Decision Coverage requires that each control structure evaluate to both TRUE and FALSE.  This is a pretty good criteria because it generally ensures that both the TRUE and FALSE paths of an expression are covered.  However, short-circuit operators will prevent some portions of a complex expression from being evaluated.
    2424= Condition Coverage =
    2525
    2626
    27 TBD
     27Condition Coverage requires that each boolean sub-expression evaluate to both TRUE and FALSE.  This criteria goes a little further than Decision Coverage by ensuring that the component parts of a compound expression each evaluate to TRUE and FALSE.  But it should be noted that this does not necessarily imply decision coverage.  This issue usually requires Decision Coverage and Condition Coverage to be applied together.
    2828= Object Coverage =
    2929
    3030
    31 Object Coverage requires that each line of generated assembly been executed.
     31Object Coverage requires that each line of generated assembly be executed.  This can be a very good general criteria because it ensures test cases for most of what the other criteria ensure.
     32= Criteria Relationships =
     33
     34
     35[[Image(CoverageCategories.png)]]]]
     36
     37Each 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 Condition/Decision Coverage.  If the test suite satisfies Statement Coverage, it will partially satisfy Decision Coverage and Condition/Decision Coverage.  If the test suite satisfies Decision Coverage, it will completely satisfy Statement Coverage and partially satisfy Condition/Decision Coverage.  There is also a complexity relationship where Statement Coverage is the least complex to satisfy and Condition/Decision Coverage is the most complex to satisfy.  The last thing to note in the picture is the fact that Object Coverage satisfies part of all of the other criteria.
     38
     39<br style="clear: both" />
    3240= An Example =
    3341
     
    5260
    5361
    54 Statement Coverage requires that each line of source code must be executed.  In our example, a single test case that allows the if statement to evaluate to TRUE will achieve 100% Statement Coverage.
     62A single test case that allows the if statement to evaluate to TRUE will achieve 100% Statement Coverage.
    5563= Decision Coverage =
    5664
    5765
    58 Decision Coverage requires that each control structure evaluate to both TRUE and FALSE.  In our example, two test cases are required to achieve 100% Decision Coverage.  One case must allow the if statement to evaluate to TRUE and the other case must allow the if statement to evaluate to FALSE.
     66Two test cases are required to achieve 100% Decision Coverage.  One case must force the if statement to evaluate to TRUE and the other case must force the if statement to evaluate to FALSE.
    5967= Condition Coverage =
    6068
    6169
    62 TBD
     70Two test case are required to achieve 100% Condition Coverage.  In one case x must be TRUE while y is FALSE and in the other case x must be FALSE while y is TRUE.
    6371= Object Coverage =
    6472
    6573
    66 Object Coverage requires that each line of generated assembly been executed.  In our example, only a test case where x is FALSE and y is TRUE will achieve 100% Object Coverage.
    67 = Criteria Relationships =
    68 
    69 
    70 [[Image(CoverageCategories.png)]]]]
    71 
    72 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 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.
    73 
    74 <br style="clear: both" />
     74Only a carefully chosen test case where x is FALSE and y is TRUE will achieve 100% Object Coverage.