next up previous contents
Next: Generalized Observations Concerning Up: Run-time Software Assertions Previous: Run-time Software Assertions

Strategic Assertion Placement

We advocate a middle ground between no software assertions at all (a common practice that fortunately is becoming less common) and the maximum of assertions on every statement in a program. Our compromise is to place assertions only at locations where traditional testing is unlikely to uncover software defects. Once testing is completed, the embedded assertions may be removed or deactivated.gif

Assertions can be extremely powerful testing aides; however they are expensive to derive, instrument (insert), and execute. Thus if we can find ways to better isolate where they are needed, we can not only improve the likelihood of fault detection at those places, but we can also avoid the cost of using assertions at those places where they are less helpful.

To date, assertion localization has been, at best, performed in an adhoc manner. The process has traditionally been developers sprinkling code with assertions in places that interested them. Our model is that assertions need to be placed where the test cases that will be used on the code are helpless in detecting faults. In our opinion, this makes assertion placement more systematic, and enhances the ability of software testing to detect faults.

Predicting where faults may hide is an expensive process because there are so many considerations that must be factored in. We employ sensitivity analysis to gather this information. Sensitivity analysis is a dynamic approach for predicting where faults will hide from test cases [8]. Sensitivity analysis predicts the likelihood that a test scheme will:

  1. exercise the code (i.e., enforce reachability),
  2. cause internal states to become corrupted when defects are exercised, and
  3. propagate data state errors to the output space.
These three conditions must occur in order for defects to be observed. To assess reachability, sensitivity analysis tracks how frequently statements in a program are exercised. To assess (2) and (3), sensitivity analysis employs a variety of different fault-injection techniques that both mutate the software and mutate the internal program states that are created during execution.



next up previous contents
Next: Generalized Observations Concerning Up: Run-time Software Assertions Previous: Run-time Software Assertions



Roger Gima
Tue Jan 20 16:43:17 EST 1998