Black Box Testing m10L24
Black Box Testing m10L24
Black Box Testing m10L24
10
Coding and Testing
Version 2 CSE IIT, Kharagpur
Lesson
24
Black-Box Testing
Version 2 CSE IIT, Kharagpur
Specific Instructional Objectives
At the end of this lesson the student would be able to:
Unit testing
Unit testing is undertaken after a module has been coded and successfully
reviewed. Unit testing (or module testing) is the testing of different units (or
modules) of a system in isolation.
• The procedures belonging to other modules that the module under test
calls.
• Nonlocal data structures that the module accesses.
• A procedure to call the functions of the module under test with
appropriate parameters.
Modules required to provide the necessary environment (which either call or are
called by the module under test) is usually not available until they too have been
unit tested, stubs and drivers are designed to provide the complete environment
for a module. The role of stub and driver modules is pictorially shown in fig. 10.1.
A stub procedure is a dummy procedure that has the same I/O parameters as the
given procedure but has a highly simplified behavior. For example, a stub
procedure may produce the expected behavior using a simple table lookup
Fig. 10.1: Unit testing with the help of driver and stub modules
Example#1: For a software that computes the square root of an input integer
which can assume values in the range of 0 to 5000, there are three equivalence
classes: The set of negative integers, the set of integers in the range of 0 and
5000, and the integers larger than 5000. Therefore, the test cases must include
representatives for each of the three equivalence classes and a possible test set
can be: {-5,500,6000}.
Example#2: Design the black-box test suite for the following program. The
program computes the intersection point of two straight lines and displays the
result. It reads two integer pairs (m1, c1) and (m2, c2) defining the two straight
lines of the form y=mx + c.
Now, selecting one representative value from each equivalence class, the test
suit (2, 2) (2, 5), (5, 5) (7, 7), (10, 10) (10, 10) are obtained.
Example: For a function that computes the square root of integer values in the
range of 0 and 5000, the test cases must include the following values: {0, -
1,5000,5001}.