Figure 2.6.1.2B: Data flow dependencies between the modules of U1
2.6.1.2.1 White-box unit tests
The objective of white-box testing is to check the internal logic of the
software. White-box tests are sometimes known as 'path test s', 'structure
tests' or 'logic tests'. A more appropriate title for this kind of test is 'glassbox
test', as the engineer can see almost everything that the code is doing.
White-box unit tests are designed by examining the internal logic of
each module and defining the input data sets that force the execution of
different paths through the logic. Each input data set is a test case.
Traditionally, programmers used to insert diagnostic code to follow
the internal processing (e.g. statements that print out the values of program
variables during execution). Debugging tools that allow programmers to
observe the execution of a program step-by-step in a screen display make
the insertion of diagnostic code unnecessary, unless manual control of
execution is not appropriate, such as when real-time code is tested.
When debugging tools are used for white-box testing, prior
preparation of test cases and procedures is still necessary. Test cases and
procedures should not be invented during debugging. The Structured
Testing method (see Section 3.6) is the best known method for white-box
unit testing. The cyclomatic complexity value gives the number of paths that
must be executed, and the 'baseline method' is used to define the paths.
Lastly, input values are selected that will cause each path to be executed.
This is called 'sensitising the path'.
A limitation of white-box testing is its inability to show missing logic.
Black-box tests remedy this deficiency