In this technique, we do not use the code to determine a test suite; rather, knowing the problem that we are trying to solve, we came up with four types of test data:

Easy-to-compute data
Typical data
Boundary/ extreme data
Bogus data

For example, suppose we are testing a functional that uses the quadratic formula to determine the two roots of a second-degree polynomial ax2+ bx + c. For simplicity, assume that we are going to work only with real numbers and print an error message if it turns out that the two roots are complex numbers (numbers involving the square root of a negative number).

We can come up with test data for each of the four cases, based on values of the polynomial's discriminate (b2-4ac):

Easy data (discriminant is a perfect square):

a

b

c

Roots

1

2

1

-1, -1

1

3

2

-1, -2



Typical Data (discriminant is positive):

a

b

c

Roots

1

4

1

-3.73205, -0.267949

2

4

1

-1.70711, -0.292893



Boundary/ Extreme data (discriminant is zero):

a

b

c

Roots

2

-4

2

1, 1

2

-8

8

2, 2



Bogus data (discriminant if negative, or a is zero):

a

b

c

Roots

1

1

1

square root of negative number

0

1

1

Division by zero

Share