Test Vector
9.1.2 Test Vector
A test vector , also called test data, is an instance of the input to a program. It is a certain configuration of the values of all the input variables. Values of individual input variables chosen in the preceding sections must be combined to obtain a test
vector. If a program has n input variables var 1 , var 2 , . . . , var n which can take on k 1 ,k 2 , . . ., k n special values, respectively, then there are k 1 ×k 2 ×···×k n possible combinations of test data.
Example: We show the number of special values of different input variables of the FSB module of Figure 9.1 in Table 9.1. Variable MODE takes on values from a discrete set of size 2 and both the values from the discrete set are con- sidered. Variables CLOCK and MODE take on values from one interval each and three special values for each of them are considered. Therefore, one can generate
2 × 3 × 3 = 18 test vectors from Table 9.1. Some programs accept a large number of input variables. Tax filing software
systems are examples of such programs. Consider all possible combinations of
a few special values of a large number of input variables is a challenging task. If a program has n input variables, each of which can take on k special values, then there are k n possible combinations of test vectors. We know that k is a small number, but n may be large. We have more than one million test vectors even for k = 3 and n = 20. Therefore, there is a need to identify a method for reducing the number of test vectors obtained by considering all possible combinations of all the sets of special values of input variables.
Howden suggested that there is no need of combining values of all input variables to design a test vector if the variables are not functionally related . To reduce the number of input combinations, Howden suggested [3, 4] that we pro- duce all possible combinations of special values of variables falling in the same functionally related subset. In this way, the total number of combinations of special values of the input variables is reduced. It is difficult to give a formal definition
TABLE 9.1 Number of Special Values of Inputs to FBS Module of Figure 9.1 Number of Special
Variable Values (k) Special Values MODE
2 {23, 79} CLOCK
3 {0x0000000, 0x000FF00, 0xFFFFFFF} ADDRESS
3 {0xFFFFF0000000, 0xFFFFF00FFF00, 0xFFFFFFFFFFFF}
9.1 FUNCTIONAL TESTING CONCEPTS OF HOWDEN
231 Functionally
related variables
Functionally related variables
(a)
(b)
Figure 9.3 Functionally related variables.
of the idea of functionally related variables, but it is easy to identify them. Let us consider the following examples:
• Variables appearing in the same assignment statement are functionally related.
• Variables appearing in the same branch predicate—the condition part of an if statement, for example—are functionally related.
Example: The program P in Figure 9.3a has five input variables such that x 1 ,...,x 4 take on three special values and x 5 is a Boolean variable. The total number of combinations of the special values of the five input variables is
3 4 × 2 = 162. Let us assume that program P has an internal structure as shown in Figure 9.3b, where variables x 1 and x 2 are functionally related and variables x 3 and x 4 are functionally related. Function f 1 uses the input variables x 1 and x 2 . Similarly, function f 2 uses the input variables x 3 and x 4 . Input variable x 5 is used to decide whether the output of f 1 or the output of f 2 will be the output of P. We consider 3 2 = 9 different combination of x 1 and x 2 as input to f 1 , 9 different combinations of x 3 and x 4 as input to f 2 , and two different values of x 5 to the decision box d in P . We need 36 [(9 + 9) × 2] combinations of the five input variables x 1 ,...,x 5 , which is much smaller than 162.