Professional Documents
Culture Documents
In Chapter 3, we saw that a function maps values from one set (its domain) to values in another set
(its range) and that the domain and range can be cross products of other sets. Any program can be
considered to be a function in the sense that program inputs form its domain and program outputs
form its range. In this and the next two chapters, we examine how to use knowledge of the func-
tional nature of a program to identify test cases for the program. Input domain testing (also called
“boundary value testing”) is the best-known specification-based testing technique. Historically,
this form of testing has focused on the input domain; however, it is often a good supplement to
apply many of these techniques to develop range-based test cases.
There are two independent considerations that apply to input domain testing. The first asks
whether or not we are concerned with invalid values of variables. Normal boundary value testing
is concerned only with valid values of the input variables. Robust boundary value testing consid-
ers invalid and valid variable values. The second consideration is whether we make the “single
fault” assumption common to reliability theory. This assumes that faults are due to incorrect val-
ues of a single variable. If this is not warranted, meaning that we are concerned with interaction
among two or more variables, we need to take the cross product of the individual variables. Taken
together, the two considerations yield four variations of boundary value testing:
For the sake of comprehensible drawings, the discussion in this chapter refers to a function, F,
of two variables x1 and x 2. When the function F is implemented as a program, the input variables
x1 and x 2 will have some (possibly unstated) boundaries:
a ≤ x1 ≤ b
c ≤ x2 ≤ d
79
© 2010 Taylor & Francis Group, LLC
80 ◾ Software Testing
x2
x1
a b
Unfortunately, the intervals [a, b] and [c, d] are referred to as the ranges of x1 and x 2, so right
away we have an overloaded term. The intended meaning will always be clear from its context.
Strongly typed languages (such as Ada® and Pascal) permit explicit definition of such variable
ranges. In fact, part of the historical reason for strong typing was to prevent programmers from
making the kinds of errors that result in faults that are easily revealed by boundary value testing.
Other languages (such as COBOL, FORTRAN, and C) are not strongly typed, so boundary value
testing is more appropriate for programs coded in these languages. The input space (domain) of
our function F is shown in Figure 5.1. Any point within the shaded rectangle and including the
boundaries is a legitimate input to the function F.
x2
x1
a b
Figure 5.2 Boundary value analysis test cases for a function of two variables.
values, and letting that variable assume its full set of test values. The normal boundary value analy-
sis test cases for our function F of two variables (illustrated in Figure 5.2) are
{<x1nom, x 2min>, <x1nom, x 2min+>, <x1nom, x 2nom>, <x1nom, x 2max–>, <x1nom, x 2max>, <x1min, x 2nom>, <x1min+,
x 2nom>, <x1max–, x 2nom>, <x1max, x 2nom>}
Chapter 7 that Boolean variables lend themselves to decision table-based testing. Logical variables
also present a problem for boundary value analysis. In the ATM example, a customer’s PIN is a
logical variable, as is the transaction type (deposit, withdrawal, or inquiry). We could go through
the motions of boundary value analysis testing for such variables, but the exercise is not very sat-
isfying to the tester’s intuition.
x2
x1
a b
maximum? If it is the angle of attack of an airplane wing, the aircraft might stall. If it is the load
capacity of a public elevator, we hope nothing special would happen. If it is a date, like May 32, we
would expect an error message. The main value of robustness testing is that it forces attention on
exception handling. With strongly typed languages, robustness testing may be very awkward. In
Pascal, for example, if a variable is defined to be within a certain range, values outside that range
result in run-time errors that abort normal execution. This raises an interesting question of imple-
mentation philosophy: is it better to perform explicit range checking and use exception handling
to deal with “robust values,” or is it better to stay with strong typing? The exception handling
choice mandates robustness testing.
x2
x1
a b
x2
x1
a b