Types of Software Testing Coverage

SoftwareTesting Objectives 

StatementCoverage 

Also known as Line Coverage, Segment Coverage, C1 and Basic Block Coverage. This measure reports whether each executable statement is encountered. Does not report whether loops reach their termination condition, only whether the loop body was executed. Statement Coverage is insensitive to logical operators. Chief advange is that it can be applied directly to object code and does not require processing source code. Chief disadvantage is that it is insensitive to certain control structures. 


Decision Coverage 

Also known as Branch Coverage, All-edges Coverage, Basic Path Coverage, C2 and Decision-decision-path testing. This measure reports whether boolean expressions tested in control structures evaluated to TRUE and FALSE. The entire boolean expression is considered one true-or-false predicate. Capable of measuring switch-statement cases, exception handlers and interrupt handlers. Chief advantage is the simplicity over Statement Coverage. Chief disadvantage is that this measure ignores branches within boolean expressions which occur due to short-circuit operators. The Number of Tests Required for Branch Coverage     


Condition Coverage 

This measure reports the true or false outcome of each boolean sub-expression. Similar to Decision Coverage but better sensitivity to control flow. Full Condition Coverage does not guarantee full Decision Coverage. 


Multiple Condition Coverage 

This measure reports whether every possible combination of boolean sub-expression occurs. The test cases required for full Multiple Condition Coverage of a condition is given by the logical operator truth table. Advantage for short-circuit operator is that it requires very thorough testing. Disadvantage is to determine the minimum number of test cases required. The number of test cases required for complex conditions can be substantial. 


Condition/Decision Coverage 

A hybrid measure composed of Condition Coverage and Decision Coverage. Chief advantage is the simplicity without the shortcoming of its component measures. 


Modified Condition/DecisionCoverage 

Also known as MC/DC and MCDC. This measures requires enough test cases to verify every condition can affect the result of its encompassing decision. 


Path Coverage 

Also known as Predicate Coverage. This measure reports whether each of the possible paths in each function have been followed. A path is a unique sequence of branches from the function entry to exit. Since loops contains an unbounded number of pahts, Path Coverage only considers a limited number of looping possibilities. This measure has the advantage of requiring very thorough testing. Chief Disadvantage is that the number of paths is exponential to the number of branches. Adding one additional branch could double the number of paths to test. Another disadvantage is that many paths are impossible to exercise due to the relationships of data. 


Function Coverage 

This measure reports whether each function or procedure is invoked in the code. Useful during preliminary testing. 


Call Coverage 

Also known as Call Pair Coverage. This measure reports whether each function call is executed. Useful in finding faults commonly occur in interfaces between modules. 


Linear Code Sequence andJump (LCSAJ) Coverage 

A variation of Path Coverage. This measure only considers the sub-path that can be easily represented in the program source code. LCSAJ is a sequence of source code lines executed in sequence. Has the advantage of more thorough than Decision Coverage yet avoids the exponential difficulty of Path Coverage. Disadvantage of not avoiding infeasible paths. 


Data Flow Coverage 

A variation of Path Coverage This measure only considers the sub-paths from variable assignments to subsequent references of the variables. Major advantage is the paths reported have direct relevance to the way the program handles data. Disadvantage is that this measure is very complex and does not include decision coverage. 


Object Code Branch Coverage 

This measure reports whether each machine language conditional branch instruction took the branch and fell through. The results depend on the compiler rather than on the program structure. It is recommended to test the original source code since it relates to program requirements better than object code. 


Loop Coverage 

This measure reports whether each loop body is executed zero times, exactly once, and more than once. For do-while loops, this measure reports whether the body is executed exactly once and more than once. Advantage of Loop Coverage is that it can determine whether while- and for- loops execute more than once. 


Race Coverage 

This measure reports whether multiple thread execute the same code at the same time. Race Coverage helps detect failure to synchronize access to resources. Useful for testing multi-threded programs. 


Relational OperatorCoverage 

This measure reports whether boundary situation occur with relational operators. Useful in finding off-by-one errors and mistaken uses of wrong relational operator such as < instead of <=. 


Weak Mutation Coverage 

This measure reports whether test cases occur which would expose the use of wrong operators and wrong operands. This measure is similar to operator coverage but much more general. Works by substituting the program's expressions with alternate operators, such as "+" substituted for "-". 


Table Coverage 

This measure indicates whether each entry in a particular array has been referenced. 



转帖:不好意思,来源忘了

posted @ 2012-03-28 23:39  sculley  阅读(196)  评论(0)    收藏  举报