Download presentation
Presentation is loading. Please wait.
1
1 PATH TESTING An Example for White-Box Testing
2
2 Path testing a form of white box testing steps to complete: –derive the module’s flow diagram –describe all possible paths through the diagram (conditions, loops) –derive path predicates –derive test-cases & results per path
3
3 PROGRAM example_1 VAR x, y : NUMBER BEGIN READ ( x, y ); IF ( x > 20) THEN BEGIN WRITE abs ( x - y ); IF ( x < y ) THEN WRITE ( “ x smaller y ”) ELSE WRITE ( “ x greater or equal y ” ) END ELSE WRITE ( “ x smaller or equal 20 ” ) END
4
4 The Flow Diagram READ x and y “x smaller or equal 20” “abs ( x - y )” “x smaller y”“x greater or equal y” x > 20x < y TRUEFALSE TRUEFALSE
5
5 Path 1 READ x and y “x smaller or equal 20” “abs ( x - y )” “x smaller y”“x greater or equal y” x > 20 x < y TRUEFALSE TRUEFALSE
6
6 Path 2: READ x and y “x smaller or equal 20”“abs ( x - y )” “x smaller y”“x greater or equal y” x > 20 x < y TRUEFALSE TRUEFALSE
7
7 Path 3: READ x and y “x smaller or equal 20”“abs ( x - y )” “x smaller y”“x greater or equal y” x > 20 x < y TRUEFALSE TRUEFALSE
8
8 Path 1 predicate: X < 20Y no constraints test-cases: (1) X : 20Y : 33 (2)X : 4Y : 1... results:(1) “x smaller or equal 20” (2) “x smaller or equal 20”...
9
9 Path 2 predicate: X > 20X < Y test-cases: (1) X : 21Y : 22 (2)X : 103Y : 203... results:(1) 1 ; “ x smaller y ” (2) 100 ; “ x smaller y ”...
10
10 Path 3 predicate: X > 20X > Y test-cases: (1) X : 21Y : 21 (2)X : 103Y : 102... results:(1) 0 ; “ x greater or equal y ” (2) 1 ; “ x greater or equal y ”...
11
11 PROGRAM example_2 VAR x, y : NUMBER BEGIN READ ( x, y ); IF ( x > 20) THEN WRITE abs ( x - y ) ELSE WRITE ( “ x smaller or equal 20 “ ); IF ( x < y ) THEN WRITE ( “ x smaller y ”) ELSE WRITE ( “ x greater or equal y “) END
12
12 End of Section 4f
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.