138
White-Box Testing Techniques III Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 9

White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

White-Box Testing Techniques III

Prepared by

Stephen M. Thebaut, Ph.D.

University of Florida

Software Testing and Verification

Lecture 9

Page 2: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

White-Box Testing Topics

• Logic coverage (lecture I)

• Dataflow coverage (lecture II)

• Path conditions and symbolic evaluation (lecture III)

• Other white-box testing strategies (e.g., “fault-based testing”) (lecture IV)

Page 3: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions

• With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box strategies. (How would you know if this were the case or not?)

• Designing additional test cases for this purpose involves identifying inputs that will cause given program paths to be executed. This can be difficult...

Page 4: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions

• With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box strategies. (How would you know if this were the case or not?)

• Designing additional test cases for this purpose involves identifying inputs that will cause given program paths to be executed. This can be difficult...

Page 5: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions (cont’d)

• To cause a path to be executed requires that the test case satisfy the path condition.

• For a given path, the PATH CONDITION is the conjunction of branch predicates that are required to hold for all the branches along the path to be taken.

Page 6: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions (cont’d)

• To cause a path to be executed requires that the test case satisfy the path condition.

• For a given path, the PATH CONDITION is the conjunction of branch predicates that are required to hold for all the branches along the path to be taken.

Page 7: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Consider an example…

(1) input(A,B)

if (A>0) then(2) Z := A

else(3) Z := 0

end_if_elseif (B>0) then

(4) Z := Z+B

end_if(5) output(Z)

What is the path condition for path <1,2,5>?

(A>0) Л (B0)

A>0

F

23

1

4

5

B>0

T

F

T

Page 8: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Consider ANOTHER example…

(1) input(A,B)

if (A>B) then(2) B := B*B

end_ifif (B<0) then

(3) Z := A

else(4) Z := B

end_if_else(5) output(Z)

What is the path condition for path <1,2,3,5>?

(A>B) Л (B<0)

A>B

F2

4

1

3

5

T

F TB<0

Page 9: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Consider ANOTHER example…

(1) input(A,B)

if (A>B) then(2) B := B*B

end_ifif (B<0) then

(3) Z := A

else(4) Z := B

end_if_else(5) output(Z)

What is the path condition for path <1,2,3,5>?

(A>B) Л (B<0) (B2<0)

A>B

F2

4

1

3

5

T

F TB<0

Page 10: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Consider ANOTHER example…

(1) input(A,B)

if (A>B) then(2) B := B*B

end_ifif (B<0) then

(3) Z := A

else(4) Z := B

end_if_else(5) output(Z)

What is the path condition for path <1,2,3,5>?

(A>B) Л (B<0) (B2<0) = FALSE

A>B

F2

4

1

3

5

T

F TB<0

Page 11: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Conclusions

• To be useful, path conditions should be expressed in terms that reflect relevant state changes along the path.

• A path is INFEASIBLE if its path condition reduces to FALSE.

• Question: if a path is infeasible, does this imply the presence of “dead code”?

Answer:

Page 12: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Conclusions

• To be useful, path conditions should be expressed in terms that reflect relevant state changes along the path.

• A path is INFEASIBLE if its path condition reduces to FALSE.

• Question: if a path is infeasible, does this imply the presence of “dead code”?

Answer:

Page 13: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Conclusions

• To be useful, path conditions should be expressed in terms that reflect relevant state changes along the path.

• A path is INFEASIBLE if its path condition reduces to FALSE.

• Question: if a path is infeasible, does this imply the presence of “dead code”?

Answer:

Page 14: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Conclusions

• To be useful, path conditions should be expressed in terms that reflect relevant state changes along the path.

• A path is INFEASIBLE if its path condition reduces to FALSE.

• Question: if a path is infeasible, does this imply the presence of “dead code”?

Answer: No; code along an infeasible path may be reachable via some other path.

Page 15: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Symbolic Evaluation

• Symbolic evaluation provides a technique for systematically tracking state changesfor the purpose of expressing path conditions in useful terms.

Page 16: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Notation

• Variable A will have a succession of symbolic values, A0, A1, A2, ..., as a path is traversed.

– Subscripts refer to the number of the previous program statement (or block of statements) executed, so some numbers may be skipped.

– With loops, statements may be executed more than once, so double subscripts will be used when necessary.

Page 17: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Notation

• Variable A will have a succession of symbolic values, A0, A1, A2, ..., as a path is traversed.

– Subscripts refer to the number of the previous program statement (or block of statements) executed, so some numbers may be skipped.

– With loops, statements may be executed more than once, so double subscripts will be used when necessary.

Page 18: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Notation

• Variable A will have a succession of symbolic values, A0, A1, A2, ..., as a path is traversed.

– Subscripts refer to the number of the previous program statement (or block of statements) executed, so some numbers may be skipped.

– With loops, statements may be executed more than once, so double subscripts will be used when necessary.

Page 19: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Notation (cont’d)

• At each statement, the same notation is used to represent program variables regardless of path, but the symbolic values will usually be different. For example:

– The notation used for the symbolic value of variable X immediately after executing statement 5 is always denoted “X5”; how-

ever, the symbolic value itself depends on which execution path is taken to statement 5.

Page 20: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Notation (cont’d)

• At each statement, the same notation is used to represent program variables regardless of path, but the symbolic values will usually be different. For example:

– The notation used for the symbolic value of variable X immediately after executing statement 5 is always denoted “X5”; how-

ever, the symbolic value itself depends on which execution path is taken to statement 5.

Page 21: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

Page 22: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH T,T

T

T

Page 23: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH T,T

(1) X1 = X02

Y1 = Y02

T

T

Page 24: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH T,T

(1) X1 = X02

Y1 = Y02

(3) X3 = X1 + 1 = X02

+ 1

Y3 = Y1 + 1 = Y02

+ 1

T

T

Page 25: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH T,T

(1) X1 = X02

Y1 = Y02

(3) X3 = X1 + 1 = X02

+ 1

Y3 = Y1 + 1 = Y02

+ 1

T

T

Page 26: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH T,F

F

T

Page 27: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH T,F

(1) X1 = X02

Y1 = Y02

T

F

Page 28: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH T,F

(1) X1 = X02

Y1 = Y02

(4) X4 = X1 - 1 = X02

- 1

Y4 = Y1 - 1 = Y02

- 1

T

F

Page 29: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH T,F

(1) X1 = X02

Y1 = Y02

(4) X4 = X1 - 1 = X02

- 1

Y4 = Y1 - 1 = Y02

- 1

T

F

Page 30: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH F,T

F

T

Page 31: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH F,T

(2) X2 = X0 + 1

Y2 = Y0 + 1

F

T

Page 32: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH F,T

(2) X2 = X0 + 1

Y2 = Y0 + 1

(3) X3 = X2 + 1 = X0 + 2

Y3 = Y2 + 1 = Y0 + 2

F

T

Page 33: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH F,T

(2) X2 = X0 + 1

Y2 = Y0 + 1

(3) X3 = X2 + 1 = X0 + 2

Y3 = Y2 + 1 = Y0 + 2

F

T

Page 34: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH F,F

F

F

Page 35: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH F,F

(2) X2 = X0 + 1

Y2 = Y0 + 1

F

F

Page 36: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH F,F

(2) X2 = X0 + 1

Y2 = Y0 + 1

(4) X4 = X2 - 1 = X0

Y4 = Y2 - 1 = Y0

F

F

Page 37: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (cont’d)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

There are 4 paths.

PATH F,F

(2) X2 = X0 + 1

Y2 = Y0 + 1

(4) X4 = X2 - 1 = X0

Y4 = Y2 - 1 = Y0

F

F

Page 38: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions Revisited

• Having symbolically evaluated the program variables along a path, we can now symbolically represent the branch predicates that are required to hold in order for the path to be traversed.

• The symbolic variable values used in each branch predicate are the values which the variables have when the branch predicate is encountered.

Page 39: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions Revisited

• Having symbolically evaluated the program variables along a path, we can now symbolically represent the branch predicates that are required to hold in order for the path to be traversed.

• The symbolic variable values used in each branch predicate are the values which the variables have when the branch predicate is encountered.

Page 40: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions Revisited

• To simplify the task of identifying inputs that will cause the path to be executed, path conditions should be expressed in terms of the initial symbolic values of variables.

Page 41: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,T

T

T

Page 42: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,T

Variable values:

X1 = X02

Y1 = Y02

X3 = X02

+ 1 Y3 = Y02

+ 1T

T

Page 43: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,T

Variable values:

X1 = X02

Y1 = Y02

X3 = X02

+ 1 Y3 = Y02

+ 1

Path Condition:

= ((X0 0) or (Y0 0)) and

((X1 < 1) or (Y1 < 1))

= ((X0 0) or (Y0 0)) and

((X02

< 1) or (Y02

< 1))

= ((X0 0) or (Y0 0) ) and

((-1 < X0 < 1) or (-1 < Y0 < 1))

T

T

Page 44: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,T

Variable values:

X1 = X02

Y1 = Y02

X3 = X02

+ 1 Y3 = Y02

+ 1

Path Condition:

= ((X0 0) or (Y0 0)) and

((X1 < 1) or (Y1 < 1))

= ((X0 0) or (Y0 0)) and

((X02

< 1) or (Y02

< 1))

= ((X0 0) or (Y0 0) ) and

((-1 < X0 < 1) or (-1 < Y0 < 1))

T

T

Page 45: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,T

Variable values:

X1 = X02

Y1 = Y02

X3 = X02

+ 1 Y3 = Y02

+ 1

Path Condition:

= ((X0 0) or (Y0 0)) and

((X1 < 1) or (Y1 < 1))

= ((X0 0) or (Y0 0)) and

((X02

< 1) or (Y02

< 1))

= ((X0 0) or (Y0 0) ) and

((-1 < X0 < 1) or (-1 < Y0 < 1))

T

T

Page 46: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,F

T

F

Page 47: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,F

Variable values:

X1 = X02

Y1 = Y02

X4 = X02

- 1 Y4 = Y02

- 1

T

F

Page 48: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,F

Variable values:

X1 = X02

Y1 = Y02

X4 = X02

- 1 Y4 = Y02

- 1

Path Condition:

= ((X0 0) or (Y0 0)) and

((X1 ≥ 1) and (Y1 ≥ 1))

= ((X0 0) or (Y0 0)) and

((X02

≥ 1) and (Y02

≥ 1))

= ((X0 0) or (Y0 0)) and

((X0 -1) or (X0 ≥ 1)) and

((Y0 -1) or (Y0 ≥ 1))

T

F

Page 49: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,F

Variable values:

X1 = X02

Y1 = Y02

X4 = X02

- 1 Y4 = Y02

- 1

Path Condition:

= ((X0 0) or (Y0 0)) and

((X1 ≥ 1) and (Y1 ≥ 1))

= ((X0 0) or (Y0 0)) and

((X02

≥ 1) and (Y02

≥ 1))

= ((X0 0) or (Y0 0)) and

((X0 -1) or (X0 ≥ 1)) and

((Y0 -1) or (Y0 ≥ 1))

T

F

Page 50: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH T,F

Variable values:

X1 = X02

Y1 = Y02

X4 = X02

- 1 Y4 = Y02

- 1

Path Condition:

= ((X0 0) or (Y0 0)) and

((X1 ≥ 1) and (Y1 ≥ 1))

= ((X0 0) or (Y0 0)) and

((X02

≥ 1) and (Y02

≥ 1))

= ((X0 0) or (Y0 0)) and

((X0 -1) or (X0 ≥ 1)) and

((Y0 -1) or (Y0 ≥ 1))

T

F

Page 51: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,T

F

T

Page 52: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,T

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X3 = X0 + 2 Y3 = Y0 + 2

F

T

Page 53: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,T

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X3 = X0 + 2 Y3 = Y0 + 2

Path Condition:

= ((X0 >0) and (Y0 >0)) and

((X2 < 1) or (Y2 < 1))

= ((X0 >0) and (Y0 >0)) and

((X0 + 1 < 1) or (Y0 + 1 < 1))

= ((X0 >0) and (Y0 >0)) and

((X0 < 0) or (Y0 < 0))

= FALSE

F

T

Page 54: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,T

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X3 = X0 + 2 Y3 = Y0 + 2

Path Condition:

= ((X0 >0) and (Y0 >0)) and

((X2 < 1) or (Y2 < 1))

= ((X0 >0) and (Y0 >0)) and

((X0 + 1 < 1) or (Y0 + 1 < 1))

= ((X0 >0) and (Y0 >0)) and

((X0 < 0) or (Y0 < 0))

= FALSE

F

T

Page 55: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,T

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X3 = X0 + 2 Y3 = Y0 + 2

Path Condition:

= ((X0 >0) and (Y0 >0)) and

((X2 < 1) or (Y2 < 1))

= ((X0 >0) and (Y0 >0)) and

((X0 + 1 < 1) or (Y0 + 1 < 1))

= ((X0 >0) and (Y0 >0)) and

((X0 < 0) or (Y0 < 0))

= FALSE

F

T

Page 56: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,T

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X3 = X0 + 2 Y3 = Y0 + 2

Path Condition:

= ((X0 >0) and (Y0 >0)) and

((X2 < 1) or (Y2 < 1))

= ((X0 >0) and (Y0 >0)) and

((X0 + 1 < 1) or (Y0 + 1 < 1))

= ((X0 >0) and (Y0 >0)) and

((X0 < 0) or (Y0 < 0))

= FALSE

F

T

Page 57: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,F

F

F

Page 58: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,F

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X4 = X0 Y4 = Y0

F

F

Page 59: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,F

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X4 = X0 Y4 = Y0

Path Condition:

= ((X0 >0) and (Y0 >0)) and

((X2 ≥ 1) and (Y2 ≥ 1))

= ((X0 >0) and (Y0 >0)) and

((X0+1 ≥ 1) and (Y0+1 ≥1))

= ((X0 >0) and (Y0 >0)) and

((X0 ≥ 0) and (Y0 ≥ 0))

= (X0 >0) and (Y0 >0)

F

F

Page 60: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,F

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X4 = X0 Y4 = Y0

Path Condition:

= ((X0 >0) and (Y0 >0)) and

((X2 ≥ 1) and (Y2 ≥ 1))

= ((X0 >0) and (Y0 >0)) and

((X0+1 ≥ 1) and (Y0+1 ≥1))

= ((X0 >0) and (Y0 >0)) and

((X0 ≥ 0) and (Y0 ≥ 0))

= (X0 >0) and (Y0 >0)

F

F

Page 61: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,F

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X4 = X0 Y4 = Y0

Path Condition:

= ((X0 >0) and (Y0 >0)) and

((X2 ≥ 1) and (Y2 ≥ 1))

= ((X0 >0) and (Y0 >0)) and

((X0+1 ≥ 1) and (Y0+1 ≥1))

= ((X0 >0) and (Y0 >0)) and

((X0 ≥ 0) and (Y0 ≥ 0))

= (X0 >0) and (Y0 >0)

F

F

Page 62: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 1 (revisited)

if (X<=0) or (Y<=0) then(1) X := X**2

Y := Y**2else

(2) X := X+1Y := Y+1

end_if_elseif (X<1) or (Y<1) then

(3) X := X+1Y := Y+1

else(4) X := X-1

Y := Y-1end_if_else

PATH F,F

Variable values:

X2 = X0 + 1 Y2 = Y0 + 1

X4 = X0 Y4 = Y0

Path Condition:

= ((X0 >0) and (Y0 >0)) and

((X2 ≥ 1) and (Y2 ≥ 1))

= ((X0 >0) and (Y0 >0)) and

((X0+1 ≥ 1) and (Y0+1 ≥1))

= ((X0 >0) and (Y0 >0)) and

((X0 ≥ 0) and (Y0 ≥ 0))

= (X0 >0) and (Y0 >0)

F

F

Page 63: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Summary of Path Conditions

TT: ((X0 0) or (Y0 0) ) and ((-1 < X0 < 1) or (-1 < Y0 < 1))

TF: ((X0 0) or (Y0 0)) and ((X0 -1) or (X0 ≥ 1)) and((Y0 -1) or (Y0 ≥ 1))

FT: FALSE

FF: (X0 >0) and (Y0 >0)

The path domains in the (X0 ,Y0 ) plane may

also be depicted graphically...

Page 64: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Graph of Path Domains

TFFF

Y0 = 1

Y0 = -1

X0 = 1X0 = -1

TT X0

Y0

Page 65: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Incremental Generation of Path

Conditions

• Path conditions can also be generated incrementally, by considering the branches taken in a piecemeal fashion.

Page 66: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

..

.

PARTIAL PATH T

T

Page 67: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

..

.

PARTIAL PATH T

Variable values:

A0, B0

T

Page 68: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

..

.

PARTIAL PATH T

Variable values:

A0, B0

Partial path condition:

(B0 > A0+1)

T

Page 69: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

..

.

PARTIAL PATH F

F

Page 70: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

..

.

PARTIAL PATH F

Variable values:

A0, B0

F

Page 71: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

..

.

PARTIAL PATH F

Variable values:

A0, B0

Partial path condition:

(B0 A0+1)

F

Page 72: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Partial Path Domains

B0 = A0 + 1

T

F

A0

B0

Page 73: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TT

T

T

Page 74: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TT

Variable values:

A1 = A0 +1

B1 = B0

T

T

Page 75: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TT

Variable values:

A1 = A0 +1

B1 = B0

Partial path condition:

(B0 > A0+1) and

(B1 > -A1+2)

= (B0 > A0+1) and

(B0 > -A0+1)

T

T

Page 76: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TT

Variable values:

A1 = A0 +1

B1 = B0

Partial path condition:

(B0 > A0+1) and

(B1 > -A1+2)

= (B0 > A0+1) and

(B0 > -A0+1)

T

T

Page 77: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TT

Variable values:

A1 = A0 +1

B1 = B0

Partial path condition:

(B0 > A0+1) and

(B1 > -A1+2)

= (B0 > A0+1) and

(B0 > -A0+1)

T

T

Page 78: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TF

T

F

Page 79: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TF

Variable values:

A1 = A0 +1

B1 = B0

T

F

Page 80: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TF

Variable values:

A1 = A0 +1

B1 = B0

Partial path condition:

(B0 > A0+1) and

(B1 -A1+2)

= (B0 > A0+1) and

(B0 -A0+1)

T

F

Page 81: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TF

Variable values:

A1 = A0 +1

B1 = B0

Partial path condition:

(B0 > A0+1) and

(B1 -A1+2)

= (B0 > A0+1) and

(B0 -A0+1)

T

F

Page 82: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TF

Variable values:

A1 = A0 +1

B1 = B0

Partial path condition:

(B0 > A0+1) and

(B1 -A1+2)

= (B0 > A0+1) and

(B0 -A0+1)

T

F

Page 83: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FT

F

T

Page 84: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FT

Variable values:

A2 = A0

B2 = B0-1

F

T

Page 85: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FT

Variable values:

A2 = A0

B2 = B0-1

Partial path condition:

(B0 A0+1) and

(B2 > -A2+2)

= (B0 A0+1) and

(B0 > -A0+3)

F

T

Page 86: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FT

Variable values:

A2 = A0

B2 = B0-1

Partial path condition:

(B0 A0+1) and

(B2 > -A2+2)

= (B0 A0+1) and

(B0 > -A0+3)

F

T

Page 87: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FT

Variable values:

A2 = A0

B2 = B0-1

Partial path condition:

(B0 A0+1) and

(B2 > -A2+2)

= (B0 A0+1) and

(B0 > -A0+3)

F

T

Page 88: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FF

F

F

Page 89: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FF

Variable values:

A2 = A0

B2 = B0-1

F

F

Page 90: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FF

Variable values:

A2 = A0

B2 = B0-1

Partial path condition:

(B0 A0+1) and

(B2 -A2+2)

= (B0 A0+1) and

(B0 -A0+3)

F

F

Page 91: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FF

Variable values:

A2 = A0

B2 = B0-1

Partial path condition:

(B0 A0+1) and

(B2 -A2+2)

= (B0 A0+1) and

(B0 -A0+3)

F

F

Page 92: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH FF

Variable values:

A2 = A0

B2 = B0-1

Partial path condition:

(B0 A0+1) and

(B2 -A2+2)

= (B0 A0+1) and

(B0 -A0+3)

F

F

Page 93: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Partial Path Domains (cont’d)

B0 = A0 + 1

A0

B0

B0 = -A0 + 3

B0 = -A0 + 1

FF

TF

FTTT

Page 94: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TTT

T

T

T

Page 95: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TTT

Variable values:

A1 = A0 +1

A3 = A1 + 2 = A0 + 3

T

T

T

Page 96: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TTT

Variable values:

A1 = A0 +1

A3 = A1 + 2 = A0 + 3

B3 = B1 = B0

T

T

T

Page 97: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TTT

Variable values:

A1 = A0 +1

A3 = A1 + 2 = A0 + 3

B3 = B1 = B0

Partial path condition:

(B0 > A0+1) and

(B0 > -A0+1) and

(B3 0) = (B0 0)

= FALSE

T

T

T

Page 98: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TTT

Variable values:

A1 = A0 +1

A3 = A1 + 2 = A0 + 3

B3 = B1 = B0

Partial path condition:

(B0 > A0+1) and

(B0 > -A0+1) and

(B3 0) = (B0 0)

= FALSE

T

T

T

Page 99: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TTT

Variable values:

A1 = A0 +1

A3 = A1 + 2 = A0 + 3

B3 = B1 = B0

Partial path condition:

(B0 > A0+1) and

(B0 > -A0+1) and

(B3 0) = (B0 0)

= FALSE

T

T

T

Page 100: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Partial Path Domains Revisited

B0 = A0 + 1

A0

B0

B0 = -A0 + 3

B0 = -A0 + 1

FF

TF

FTTT

Page 101: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Partial Path Domains Revisited

B0 = A0 + 1

A0

B0

B0 = -A0 + 3

B0 = -A0 + 1

FF

TF

FTTT

B0 0

Page 102: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 2 (cont’d)

if (B > A+1) then(1) A := A+1

else(2) B := B-1

end_if_elseif (B > -A+2) then

(3) A := A+2else

(4) B := B+1end_if_elseif (B <= 0) then

.

.

.

PARTIAL PATH TTT

Variable values:

A1 = A0 +1

A3 = A1 + 2 = A0 + 3

B3 = B1 = B0

Partial path condition:

(B0 > A0+1) and

(B0 > -A0+1) and

(B3 0) = (B0 0)

= FALSE

T

T

T

Page 103: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Loops

• In general, the simplification of path conditions involving loops is very difficult.

• The simplest form that is obtainable for N

iterations of a loop may involve N terms.

• “N iterations” =

– While loop body executes N-1 times

– Repeat_Until loop body executes N

times

Page 104: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Loops

• In general, the simplification of path conditions involving loops is very difficult.

• The simplest form that is obtainable for N

iterations of a loop may involve N terms.

• “N iterations” =

– While loop body executes N-1 times

– Repeat_Until loop body executes N

times

Page 105: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Loops

• In general, the simplification of path conditions involving loops is very difficult.

• The simplest form that is obtainable for N

iterations of a loop may involve N terms.

• “N iterations” =

– While loop body executes N-1 times

– Repeat_Until loop body executes N

times

Page 106: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Loops

• In general, the simplification of path conditions involving loops is very difficult.

• The simplest form that is obtainable for N

iterations of a loop may involve N terms.

• “N iterations” =

– While loop body executes N-1 times

– Repeat_Until loop body executes N

times

Page 107: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Loops

• In general, the simplification of path conditions involving loops is very difficult.

• The simplest form that is obtainable for N

iterations of a loop may involve N terms.

• “N iterations” =

– While loop body executes N-1 times

– Repeat_Until loop body executes N

times

Page 108: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Variable values: (Y does not change)

(1) X1 = X0

C1 = 0

(2,1) X2,1 = X1 – Y1 = X0 – Y0

C2,1 = C1 + 1 = 1

(2,2) X2,2 = X2,1 – Y2,1 = (X0 – Y0) - Y0 = X0 – 2Y0

C2,2 = C2,1 + 1 = 2

Page 109: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Variable values: (Y does not change)

(1) X1 = X0

C1 = 0

(2,1) X2,1 = X1 – Y1 = X0 – Y0

C2,1 = C1 + 1 = 1

(2,2) X2,2 = X2,1 – Y2,1 = (X0 – Y0) - Y0 = X0 – 2Y0

C2,2 = C2,1 + 1 = 2

Page 110: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Variable values: (Y does not change)

(1) X1 = X0

C1 = 0

(2,1) X2,1 = X1 – Y1 = X0 – Y0

C2,1 = C1 + 1 = 1

(2,2) X2,2 = X2,1 – Y2,1 = (X0 – Y0) - Y0 = X0 – 2Y0

C2,2 = C2,1 + 1 = 2

Page 111: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Variable values: (Y does not change)

(1) X1 = X0

C1 = 0

(2,1) X2,1 = X1 – Y1 = X0 – Y0

C2,1 = C1 + 1 = 1

(2,2) X2,2 = X2,1 – Y2,1 = (X0 – Y0) - Y0 = X0 – 2Y0

C2,2 = C2,1 + 1 = 2

Page 112: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Variable values: (cont’d)

(2,2) X2,2 = X0 – 2Y0

C2,2 = 2

(2,3) X2,3 = X2,2 – Y2,2 = (X0 – 2Y0) - Y0 = X0 – 3Y0

C2,3 = C2,2 + 1 = 3

(2,N) X2,N = X0 – NY0

C2,N = N

Page 113: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Variable values: (cont’d)

(2,2) X2,2 = X0 – 2Y0

C2,2 = 2

(2,3) X2,3 = X2,2 – Y2,2 = (X0 – 2Y0) - Y0 = X0 – 3Y0

C2,3 = C2,2 + 1 = 3

(2,N) X2,N = X0 – NY0

C2,N = N

Page 114: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Variable values: (cont’d)

(2,2) X2,2 = X0 – 2Y0

C2,2 = 2

(2,3) X2,3 = X2,2 – Y2,2 = (X0 – 2Y0) - Y0 = X0 – 3Y0

C2,3 = C2,2 + 1 = 3

(2,N) X2,N = X0 – NY0

C2,N = N

Page 115: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Variable values: (cont’d)

(2,2) X2,2 = X0 – 2Y0

C2,2 = 2

(2,3) X2,3 = X2,2 – Y2,2 = (X0 – 2Y0) - Y0 = X0 – 3Y0

C2,3 = C2,2 + 1 = 3

(2,N) X2,N = X0 – NY0

C2,N = N

Page 116: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Path Condition for Path F: (loop body executed 0 times)

(X1 < Y1) = X0 <Y0

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0

C2,N = N

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 117: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Path Condition for Path F: (loop body executed 0 times)

(X1 < Y1) = X0 <Y0

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0

C2,N = N

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 118: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Path Condition for Path F: (loop body executed 0 times)

(X1 < Y1) = X0 <Y0

Path Condition for Path T,F:

(loop body executed 1 time)

(X1 ≥ Y1) and (X2,1 <Y2,1)

= (X0 ≥ Y0) and (X0 - Y0 <Y0)

= (X0 ≥ Y0) and (X0 <2Y0)

= Y0 ≤ X0 <2Y0

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0

C2,N = N

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 119: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Path Condition for Path F: (loop body executed 0 times)

(X1 < Y1) = X0 <Y0

Path Condition for Path T,F:

(loop body executed 1 time)

(X1 ≥ Y1) and (X2,1 <Y2,1)

= (X0 ≥ Y0) and (X0 - Y0 <Y0)

= (X0 ≥ Y0) and (X0 <2Y0)

= Y0 ≤ X0 <2Y0

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0

C2,N = N

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 120: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Path Condition for Path F: (loop body executed 0 times)

(X1 < Y1) = X0 <Y0

Path Condition for Path T,F:

(loop body executed 1 time)

(X1 ≥ Y1) and (X2,1 <Y2,1)

= (X0 ≥ Y0) and (X0 - Y0 <Y0)

= (X0 ≥ Y0) and (X0 <2Y0)

= Y0 ≤ X0 <2Y0

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0

C2,N = N

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 121: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Path Condition for Path F: (loop body executed 0 times)

(X1 < Y1) = X0 <Y0

Path Condition for Path T,F:

(loop body executed 1 time)

(X1 ≥ Y1) and (X2,1 <Y2,1)

= (X0 ≥ Y0) and (X0 - Y0 <Y0)

= (X0 ≥ Y0) and (X0 <2Y0)

= Y0 ≤ X0 <2Y0

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0

C2,N = N

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 122: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0 C2,N = N

Path Condition for Path T,T,F: (loop body executed 2

times)

(X1 ≥ Y1) and (X2,1 ≥ Y2,1) and (X2,2 <Y2,2)

= (X0 ≥ Y0) and (X0 - Y0 ≥ Y0) and (X0 - 2Y0 <Y0)

= (X0 ≥ Y0) and (X0 ≥ 2Y0) and (X0 <3Y0)

= (X0 ≥ Y0) and (2Y0 ≤ X0 <3Y0)

= 2Y0 ≤ X0 <3Y0 since (2Y0 < 3Y0 ) => Y0 > 0 => (X0 ≥ 2Y0 => X0 ≥ Y0)

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 123: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0 C2,N = N

Path Condition for Path T,T,F: (loop body executed 2

times)

(X1 ≥ Y1) and (X2,1 ≥ Y2,1) and (X2,2 <Y2,2)

= (X0 ≥ Y0) and (X0 - Y0 ≥ Y0) and (X0 - 2Y0 <Y0)

= (X0 ≥ Y0) and (X0 ≥ 2Y0) and (X0 <3Y0)

= (X0 ≥ Y0) and (2Y0 ≤ X0 <3Y0)

= 2Y0 ≤ X0 <3Y0 since (2Y0 < 3Y0 ) => Y0 > 0 => (X0 ≥ 2Y0 => X0 ≥ Y0)

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 124: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0 C2,N = N

Path Condition for Path T,T,F: (loop body executed 2

times)

(X1 ≥ Y1) and (X2,1 ≥ Y2,1) and (X2,2 <Y2,2)

= (X0 ≥ Y0) and (X0 - Y0 ≥ Y0) and (X0 - 2Y0 <Y0)

= (X0 ≥ Y0) and (X0 ≥ 2Y0) and (X0 <3Y0)

= (X0 ≥ Y0) and (2Y0 ≤ X0 <3Y0)

= 2Y0 ≤ X0 <3Y0 since (2Y0 < 3Y0 ) => Y0 > 0 => (X0 ≥ 2Y0 => X0 ≥ Y0)

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 125: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0 C2,N = N

Path Condition for Path T,T,F: (loop body executed 2

times)

(X1 ≥ Y1) and (X2,1 ≥ Y2,1) and (X2,2 <Y2,2)

= (X0 ≥ Y0) and (X0 - Y0 ≥ Y0) and (X0 - 2Y0 <Y0)

= (X0 ≥ Y0) and (X0 ≥ 2Y0) and (X0 <3Y0)

= (X0 ≥ Y0) and (2Y0 ≤ X0 <3Y0)

= 2Y0 ≤ X0 <3Y0 since (2Y0 < 3Y0 ) => Y0 > 0 => (X0 ≥ 2Y0 => X0 ≥ Y0)

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 126: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Variable values:

X1= X0 C1= 0

X2,N = X0 – NY0 C2,N = N

Path Condition for Path T,T,F: (loop body executed 2

times)

(X1 ≥ Y1) and (X2,1 ≥ Y2,1) and (X2,2 <Y2,2)

= (X0 ≥ Y0) and (X0 - Y0 ≥ Y0) and (X0 - 2Y0 <Y0)

= (X0 ≥ Y0) and (X0 ≥ 2Y0) and (X0 <3Y0)

= (X0 ≥ Y0) and (2Y0 ≤ X0 <3Y0)

= 2Y0 ≤ X0 <3Y0 since (2Y0 < 3Y0 ) => Y0 > 0 => (X0 ≥ 2Y0 => X0 ≥ Y0)

(1) C := 0while (X>=Y) do

(2) X := X-YC := C+1

end_while

Page 127: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Path Condition for N>1 iterations of the loop:

(X1 ≥ Y1) and (X2,1 ≥ Y2,1) and … and (X2,N-1 ≥ Y2,N-1)

and (X2,N <Y2,N)

Page 128: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Example 3 (cont’d)

Path Condition for N>1 iterations of the loop:

(X1 ≥ Y1) and (X2,1 ≥ Y2,1) and … and (X2,N-1 ≥ Y2,N-1)

and (X2,N <Y2,N)

It can be proven by induction that this condition may be expressed in CLOSED FORM as:

(N-1)Y0 ≤ X0 < NY0

with the implied (eventual termination) condition that Y0 > 0.

Page 129: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions & Symbolic

Evaluation Summary

• To cause a path to be executed requires that the test case satisfy its path condition.

• The path condition is the conjunction of branch predicates that are required to hold for all the branches along the path.

• In general, the simplification of path conditions for loops is very difficult. (The simplest form that is obtainable for N

iterations of a loop may involve N terms.)

Page 130: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions & Symbolic

Evaluation Summary

• To cause a path to be executed requires that the test case satisfy its path condition.

• The path condition is the conjunction of branch predicates that are required to hold for all the branches along the path.

• In general, the simplification of path conditions for loops is very difficult. (The simplest form that is obtainable for N

iterations of a loop may involve N terms.)

Page 131: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions & Symbolic

Evaluation Summary

• To cause a path to be executed requires that the test case satisfy its path condition.

• The path condition is the conjunction of branch predicates that are required to hold for all the branches along the path.

• In general, the simplification of path conditions for loops is very difficult. (The simplest form that is obtainable for N

iterations of a loop may involve N terms.)

Page 132: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions & Symbolic

Evaluation Summary (cont’d)

• A path is infeasible if its path condition reduces to FALSE.

• Symbolic evaluation provides a systematic method for expressing path conditions in terms of the initial symbolic values of program variables.

Page 133: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions & Symbolic

Evaluation Summary (cont’d)

• A path is infeasible if its path condition reduces to FALSE.

• Symbolic evaluation provides a systematic method for expressing path conditions in terms of the initial symbolic values of program variables.

Page 134: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions & Symbolic

Evaluation Summary (cont’d)

• This simplifies the task of identifying inputs that will cause the path to be executed.

• But this “satisfiability problem” can be very difficult to solve…

Page 135: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Path Conditions & Symbolic

Evaluation Summary (cont’d)

• This simplifies the task of identifying inputs that will cause the path to be executed.

• But this “satisfiability problem” can be very difficult to solve…

Page 136: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Exactly HOW Difficult…?

• Given a Boolean expression E, decide if there is some assignment to the variables in E such that E will be true.

• This was the first problem shown to be NP-complete!

Page 137: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

Exactly HOW Difficult…?

• Given a Boolean expression E, decide if there is some assignment to the variables in E such that E will be true.

• This was the first problem shown to be NP-complete!

Page 138: White-Box Testing Techniques III · Path Conditions •With a little luck, at least some white-box coverage goals will have been met by executing test cases designed using black-box

White-Box Testing Techniques III

Prepared by

Stephen M. Thebaut, Ph.D.

University of Florida

Software Testing and Verification

Lecture 9