Software Testing Strategies
Unit Testing
It focuses on the smallest unit of software design - the software
component or module. Using the component level design description
as a guide, important control paths are tested to uncover errors
within the boundary of the module. The relative complexity of tests
and uncovered errors is limited by the constrained scope established
for unit testing. The unit test is white-box oriented, and the step
can be conducted in parallel for multiple components. The tests
that occur as part of unit tests are listed below:
- Module Interface is tested to ensure that information properly
flows into and out of the program unit under test. Tests of data
flow across a module interface are required before any other test
is initiated. If data does not enter and exit properly, all other
tests are moot.
- Local Data Structures are examined to ensure that data stored
temporarily maintains its integrity during all steps in an algorithm's
execution.
- Boundary Conditions are tested to ensure that the module operates
properly at boundaries established to limit or restrict processing.
- Independent Paths are exercised to ensure that all statements
in a module have been executed at least once.
- Error Handling Paths are also tested.
Selective testing of execution paths is an essential task during
the unit test. Basis path and loop testing are effective techniques
for uncovering a broad array of path errors.Among the more common
errors in computation are
- misunderstood or incorrect arithmetic precedence,
- mixed mode operations
- incorrect initialization
- precision inaccuracy
- incorrect symbolic representation of an expression.
Comparison and control flow are closely coupled to one another
(i.e., change of flow frequently occurs after a comparison). Test
cases should uncover errors such as
- comparison of different data types
- incorrect logical operators or precedence
- expectation of equality when precision error makes equality
unlikely
- incorrect comparison of variables
- improper or nonexistent loop termination
- failure to exit when divergent iteration is encountered
- improperly modified loop variables
Among the potential errors that should be tested when error handling
is evaluated
- Error description is unintelligible
- Error noted does not correspond to error encountered
- Error condition causes system intervention prior to error handling
- Exception-condition processing is incorrect
- Error description does not provide enough information to assist
in the location of the cause of the error.
Boundary testing is the last (and probably most important) task
of the unit test step. Software often fails at its boundaries. That
is, errors often occur when the nth element of an n-dimensional
array is processed, when the ith repetition of a loop with i passes
is invoked, when the maximum or minimum allowable value is encountered.
|