Control-Flow-Based Coverage Criteria ------------------------------------ Path Coverage: Execute every possible path of the program (all variable values and combinations) In general can't be archieved Statement Coverage: Execute every program statement at least once Branch Coverage: Execute all branches in a program Decision Coverage: Exercise every decision(boolean expression) outcome at least once Decision Coverage != Branch Coverage Condition Coverage: Every sub expression (atom) outcome is exercised e.g. ((x>0) && (y>0)) Inputs x=5, y=-3 and x=-3, y=5 Condition coverage but no decision coverage! Condition/Decision C.: Combination of Condition and Decision Coverage Cover all condition outcomes + cover all decision outcomes MC/DC: Each condition coutcome must affect the decision outcome independently (P.34) Fix the value of all conditions in a decision except for one Flipping that one condition must change the decision outcome Each outcome of the condition must influence the outcome of the decision at least once Data-Flow-Based Coverage Criteria --------------------------------- def: assignment of a value to a variable use: statement where the value is read c-use: computational use (right hand side) p-use: predicate use def-use chain: cycle-free path; first statement defines value; last statement uses value; no re-definitions def-clear path: traverses no location twice (exception first=last); xis not re-defined in between all-defs: all definitions get used all-c-uses: all computations affected by each definition are executed all-p-uses: all decisions affected by each definitiona re executed all-c-uses/some-p-uses: all definitions used, and if they affect computations, then all affected computations are executed all-p-uses/some-c-uses: all definitions used, and if they affect decisions, then all affected decisions are executed all-uses: every computation and decision affected by definition executed all-du-paths: like all-uses but all def-use paths all-paths | all-du-paths | all-uses / \ / \ all-c/some-p all-p/some-c | \ / | | \ / | all-c-uses all-defs all-p-uses