Investigating the use of analysis contracts to improve the testability of object‐oriented code
- 5 March 2003
- journal article
- research article
- Published by Wiley in Software: Practice and Experience
- Vol. 33 (7) , 637-672
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. Copyright © 2003 John Wiley & Sons, Ltd.Keywords
This publication has 10 references indexed in Scilit:
- An empirical evaluation of statistical testing designed from UML state diagrams: the flight guidance system case study2005
- Building trust into OO components using a genetic analogy2002
- Reliable objects: lightweight testing for oo languagesIEEE Software, 2001
- On testable object-oriented programmingACM SIGSOFT Software Engineering Notes, 1997
- My hairiest bug war storiesCommunications of the ACM, 1997
- A practical approach to programming with assertionsIEEE Transactions on Software Engineering, 1995
- Applying 'design by contract'Computer, 1992
- A fortran language system for mutation‐based software testingSoftware: Practice and Experience, 1991
- Predicting where faults can hide from testingIEEE Software, 1991
- The category-partition method for specifying and generating functional testsCommunications of the ACM, 1988