20
Chapter 9: Path Testing Csci 565 Spring 2009

Chapter 9: Path Testing

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

Page 1: Chapter 9: Path Testing

Chapter 9: Path Testing

Csci 565Spring 2009

Page 2: Chapter 9: Path Testing

Objectives Decision-to-decision path (DD-Paths) Test Coverage Metrics Basis Path Testing Observation on McCabe Basis Path Method Essential Complexity

Page 3: Chapter 9: Path Testing
Page 4: Chapter 9: Path Testing
Page 5: Chapter 9: Path Testing
Page 6: Chapter 9: Path Testing
Page 7: Chapter 9: Path Testing
Page 8: Chapter 9: Path Testing
Page 9: Chapter 9: Path Testing

t f

t

ff

f

f

Page 10: Chapter 9: Path Testing

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%

Page 11: Chapter 9: Path Testing

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

Page 12: Chapter 9: Path Testing

Basis Path Testing

Page 13: Chapter 9: Path Testing
Page 14: Chapter 9: 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

Page 15: Chapter 9: Path Testing

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)

Page 16: Chapter 9: Path Testing

Observations on McCabe’s Basis Path

Is testing Basis path enough? Infeasible paths

Page 17: Chapter 9: Path Testing

Essential Complexity

V(G)=1wellStr(P)

V(G) >=10 requires substantial testing

Use the characteristics of code to select appropriate criteria

Page 18: Chapter 9: Path Testing
Page 19: Chapter 9: Path Testing
Page 20: Chapter 9: Path Testing

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