Using contracts and Boolean queries to improve the quality of automatic test generation

  • Authors:
  • Lisa Ling Liu;Bertrand Meyer;Bernd Schoeller

  • Affiliations:
  • Chair of Software Engineering, ETH Zurich, Switzerland;Chair of Software Engineering, ETH Zurich, Switzerland;Chair of Software Engineering, ETH Zurich, Switzerland

  • Venue:
  • TAP'07 Proceedings of the 1st international conference on Tests and proofs
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

Since test cases cannot be exhaustive, any effective test case generation strategy must identify the execution states most likely to uncover bugs. The key issue is to define criteria for selecting such interesting states. If the units being tested are classes in object-oriented programming, it seems attractive to rely on the boolean queries present in each class, which indeed define criteria on the states of the corresponding objects, and -- in contractequipped O-O software -- figure prominently in preconditions, postconditions and invariants. As these queries are part of the class specification and hence relevant to its clients, one may conjecture that the resulting partition of the state space is also relevant for tests. We explore this conjecture by examining whether relying on the boolean queries of a class to extract abstract states improves the results of black-box testing. The approach uses constraint-solving and proof techniques to generate objects that satisfy the class invariants, then performs testing by relying on postconditions as test oracles. The resulting strategy, in our experiments on library classes used in production software, finds significantly more bugs than random testing.