Testing - Module 3
Testing - Module 3
(1) Knowing the specified function that a product has been designed to perform, tests can be conducted that
demonstrate each function is fully operational while at the same time searching for errors in each function.
The first test approach takes an external view and is called black-box testing.
(2) Knowing the internal workings of a product, tests can be conducted to ensure that “all gears mesh,” that
is, internal operations are performed according to specifications and all internal components have been
adequately exercised. The second requires an internal view and is termed white-box testing.
A: WHITE-BOX TESTING
White-box testing, sometimes called glass-box testing or structural testing, is a test-case design philosophy
that uses the control structure described as part of component-level design to derive test cases. Using white-
box testing methods, we can derive test cases that (1) guarantee that all independent paths within a module
have been exercised at least once, (2) exercise all logical decisions on their true and false sides, (3) execute
all loops at their boundaries and within their operational bounds, and (4) exercise internal data structures
to ensure their validity.
Basis path testing is a white-box testing technique which enables the test-case designer to derive a logical
complexity measure of a procedural design and use this measure as a guide for defining a basis set of
execution paths. Test cases derived to exercise the basis set are guaranteed to execute every statement in
the program at least one time during testing.
The flow graph depicts logical control flow using the notation illustrated in Figure
To illustrate the use of a flow graph, consider the procedural design representation in Figure 23.2a . Here, a
flowchart is used to depict program control structure.
When compound conditions are encountered in a procedural design, the generation of a flow graph
becomes slightly more complicated. A compound condition occurs when one or more Boolean operators
(logical OR, AND, NAND, NOR) is present in a conditional statement. Referring to Figure, the program
design language (PDL) segment translates into the flow graph shown. Note that a separate node is
created for each of the conditions a and b in the statement IF a OR b. Each node that contains a condition
is called a predicate node and is characterized by two or more edges emanating from it.
B : BLACK-BOX TESTING
Black-box testing, also called behavioral testing or functional testing focuses on the functional requirements
of the software. That is, black-box testing techniques enable you to derive sets of input conditions that will
fully exercise all functional requirements for a program
Black-box testing attempts to find errors in the following categories: (1) incorrect or missing
functions, (2) interface errors, (3) errors in data structures or external database access, (4) behavior
or performance errors, and (5) initialization and termination errors.
Black-box testing is focused on the information domain. Black-box tests are designed to validate
functional requirements without regard to the internal workings of a program.
Black-box testing techniques focus on the information domain of the software,deriving test cases by
partitioning the input and output domain of a program in a manner that provides thorough test
coverage.
Equivalence partitioning divides the input domain into classes of data that are likely to exercise a
specific software function.
Boundary value analysis probes the program’s ability to handle data at the limits of acceptability.
Orthogonal array testing provides an efficient, systematic method for testing systems with small
numbers of input parameters.
Model-based testing uses elements of the requirements model to test the behavior of an application.
Boundary value analysis leads to a selection of test cases that exercise bounding values.
Boundary value analysis is a test-case design technique that complements equivalence partitioning.
Rather than selecting any element of an equivalence class, BVA leads to the selection of test cases
at the “edges” of the class.
Guidelines for BVA are similar in many respects to those provided for equivalence partitioning:
1. If an input condition specifies a range bounded by values a and b, test cases should be designed with values
a and b and just above and just below a and b.
2. If an input condition specifies a number of values, test cases should be developed that exercise the
minimum and maximum numbers. Values just above and below minimum and maximum are also tested.
3. Apply guidelines 1 and 2 to output conditions. For example, assume that a temperature versus pressure
table is required as output from an engineering analysis program. Test cases should be designed to create
an output report that produces the maximum (and minimum) allowable number of table entries.
4. If internal program data structures have prescribed boundaries (e.g., a table has a defined limit of 100
entries), be certain to design a test case to exercise the data structure at its boundary.
4 Orthogonal Array Testing
Orthogonal array testing can be applied to problems in which the input domain is relativel small but too large
to accommodate exhaustive testing.
The orthogonal array testing method is particularly useful in finding region faults—an error category
associated with faulty logic within a software component.
To illustrate the difference between orthogonal array testing and more conventional “one input item at a
time” approaches, consider a system that has three input items, X, Y, and Z.
Each of these input items has three discrete values associated with it. There are 33 = 27 possible test cases.
Phadke suggests a geometric view of the possible test cases associated with X, Y, and Z illustrated in Figure .
Referring to the figure, one input item at a time may be varied in sequence along each input axis. This results
in relatively limited coverage of the input domain (represented by the left-hand cube in the figure).
When orthogonal array testing occurs, an L9 orthogonal array of test cases is created. The L9 orthogonal
array has a “balancing property”. That is, test cases (represented by dark dots in the figure) are “dispersed
uniformly throughout the test domain,” as illustrated in the right-hand cube in Figure . Test coverage across
the input domain is more complete.
To illustrate the use of the L9 orthogonal array, consider the send function for a fax application. Four
parameters, P1, P2, P3, and P4, are passed to the send function. Each takes on three discrete values. For
example, P1 takes on values:
P1 = 1, send it now
P1 = 2, send it one hour later
P1 = 3, send it after midnight
P2, P3, and P4 would also take on values of 1, 2 and 3, signifying other send functions.
If a “one input item at a time” testing strategy were chosen, the following sequence of tests
(P1, P2, P3, P4) would be specified: (1, 1, 1, 1), (2, 1, 1, 1), (3, 1, 1, 1), (1, 2, 1, 1), (1, 3, 1, 1), (1, 1, 2, 1), (1, 1,
3, 1), (1, 1, 1, 2), and (1, 1, 1, 3). But these would uncover only single mode faults
[Pha97], that is, faults that are triggered by a single parameter.
Given the relatively small number of input parameters and discrete values, exhaustive testing is possible. The
number of tests required is 3 4 5 81, large but manageable. All faults associated with data item permutation
would be found, but the effort required is relatively high.
The orthogonal array testing approach enables you to provide good test coverage with far fewer test cases
than the exhaustive strategy. An L9 orthogonal array for the fax send function is illustrated in Figure .
Phadke assesses the result of tests using the L9 orthogonal array in the following manner:
Detect and isolate all single mode faults. A single mode fault is a consistent problem with any level of =any
single parameter. For example, if all test cases of factor P1 1 cause an error condition, it is a single mode
failure. In this example tests 1, 2 and 3 [ Figure 23.10 ] will show errors. By analyzing the information about
which tests show errors, one can identify which parameter values cause the fault. In this example, by noting
that tests 1, 2, and 3 cause an error, one can isolate [logical processing associated with “send it now” (P1 =
1)] as the source of the error. Such an isolation of fault is important to fix the fault.
Detect all double mode faults. If there exists a consistent problem when specific levels of two parameters
occur together, it is called a double mode fault. Indeed, a double mode fault is an indication of pair wise
incompatibility or harmful interactions between two test parameters.
Multimode faults. Orthogonal arrays [of the type shown] can assure the detection of only single and double
mode faults. However, many multi-mode faults are also detected by these tests.