Investigating the use of analysis contracts to improve the testability of object-oriented code

  • Authors:
  • L. C. Briand;Y. Labiche;H. Sun

  • Affiliations:
  • Software Quality Engineering Laboratory, Carleton University, Systems and Computer Engineering, 1125 Colonel By Drive, Ottawa, ON, K1S 5B6, Canada;Software Quality Engineering Laboratory, Carleton University, Systems and Computer Engineering, 1125 Colonel By Drive, Ottawa, ON, K1S 5B6, Canada;Software Quality Engineering Laboratory, Carleton University, Systems and Computer Engineering, 1125 Colonel By Drive, Ottawa, ON, K1S 5B6, Canada

  • Venue:
  • Software—Practice & Experience
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

A number of activities involved in testing software are known to be difficult and time consuming. Among them is the definition and coding of test oracles and the isolation of faults once failures have been detected. Through a thorough and rigorous empirical study, we investigate how the instrumentation of contracts could address both issues. Contracts are known to be a useful technique in specifying the precondition and postcondition of operations and class invariants, thus making the definition of object-oriented analysis or design elements more precise. It is one of the reasons the Object Constraint Language (OCL) was made part of the Unified Modeling Language. Our aim in this paper is to reuse and instrument contracts to ease testing. A thorough case study is run where we define OCL contracts, instrument them using a commercial tool and assess the benefits and limitations of doing so to support the automated detection of failures and the isolation of faults. As contracts can be defined at various levels of detail, we also investigate the cost and benefit of using contracts at different levels of precision. We then draw practical conclusions regarding the applicability of the approach and its limitations.