Upload
chanda-kim
View
238
Download
16
Embed Size (px)
DESCRIPTION
Chapter 9: Path Testing. Csci 565 Spring 2009. Objectives. Decision-to-decision path (DD-Paths) Test Coverage Metrics Basis Path Testing Observation on McCabe Basis Path Method Essential Complexity. f. t. t. f. f. f. f. Test Selection Criteria (white box). - PowerPoint PPT Presentation
Citation preview
Chapter 9: Path Testing
Csci 565Spring 2009
Objectives Decision-to-decision path (DD-Paths) Test Coverage Metrics Basis Path Testing Observation on McCabe Basis Path Method Essential Complexity
t f
t
ff
f
f
Test Selection Criteria (white box) Test Selection Criteria
Help us to measure the adequacy of a test suite E.g. if we use statement coverage to test 40% of the
code, it means 60 percent of code was never executed Help us to decide when to stop testing
E.g., use other criteria to cover 85%
Overview of the families of test selection criteria Families of test selection criteria include
Structural model coverage criteria All statements (AS), All Decisions (AD), All paths (AP)
APAD AS Condition coverage (CC)
A test set achieves CC when each condition in the program is tested with a true result and false results
Decision/CC (D/CC) A test set achieves D/CC when it achieves both AD and CC
Multiple condition coverage (MCC) A test set achieves MCC if it exercises all possible combinations of
condition outcomes in each decision For N conditions, it requires 2N tests
Basis Path Testing
ex1= p2+p3-p1
Ex1= (1,0,1,2,0,0,0,0,1,0) +(1,0,0,0,1,0,0,1,0,1)-(1,0,0,1,0,0,0,0,1,0)
Ex1 = (1,0,1,1,1,0,0,1,0,1)=A,B,C,B,E,F,G
ex2=2p2-p1
Ex2=(2,0,2,4,0,0,0,0,2,0) – (1,0,0,1,0,0,0,0,1,0)= (1,0,2,3,0,0,0,0,1,0)=A,B,C,B,C,B,C,G
McCabe’s Algorithmic Procedure McCable’s Algorithmic Procedure can be
used to identify a set of basis paths Select a path with highest number of decision
nodes Retrace each decision in baseline path Flip each decision to create a new path
E.g. P1: A,B,C,B,E,F,G
A,D,E,F,G (flip p1 at A) A,,B,E,F,G (flip p1 at B) A,B,C,G (flip p1 at C)
Observations on McCabe’s Basis Path
Is testing Basis path enough? Infeasible paths
Essential Complexity
V(G)=1wellStr(P)
V(G) >=10 requires substantial testing
Use the characteristics of code to select appropriate criteria
Reference Material in this presentation is taken from the
following resources: Paul C. Jorgensen. Software Testing: A Craftsman’s
Approach, 3rd Edition. Auerbach Publication, 2008