Contract-Based Testing

  • Bernhard K. Aichernig
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2757)


A tester relies on some sort of contract between the users and the implementers of a system. The contract defines the obligations of each part that are partially checked by selecting and executing test-cases. In fact, these test-cases are contracts, too, although in a rather operational form. In this article we define the general relationship between these two forms of contract and present a method how various test-selection strategies can be defined formally. More precisely, we demonstrate how test-cases can be calculated from contracts using a refinement calculus.


Formal Method Mutation Testing Disjunctive Normal Form Predicate Transformer Formal Synthesis 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aichernig, B.K., Gerstinger, A., Aster, R.: Formal specification techniques as a catalyst in validation. In: Proceedings of the 5th Conference on High-Assurance Software Engineering, Albuquerque, New Mexico, USA, November 15-17. IEEE, Los Alamitos (2000)Google Scholar
  2. 2.
    Aichernig, B.K.: Test-case calculation through abstraction. In: Oliveira, J.N., Zave, P. (eds.) FME 2001. LNCS, vol. 2021, p. 571. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  3. 3.
    Aichernig, B.K.: Test-Design through Abstraction – A Systematic Approach Based on the Refinement Calculus. Journal of Universal Computer Science 7(8), 710–735 (2001)Google Scholar
  4. 4.
    Aichernig, B.K.: The commuting V-diagram: On the relation of refinement and testing. Technical Report 254, The United Nations University, International Institute for Software Technology (UNU/IIST), P.O. Box 3058, Macau (May 2002)Google Scholar
  5. 5.
    Aichernig, B.K.: Contract-based mutation testing in the refinement calculus. In: REFINE 2002, the BCS-FACS refinement workshop, affiliated with FME 2002, Copenhagen, Denmark, July 20-21, 2002. Electronic Notes in Theoretical Computer Science (2002) (to appear)Google Scholar
  6. 6.
    Aichernig, B.: Systematic Black-Box Testing of Computer-Based Systems through Formal Abstraction Techniques. PhD thesis, Institute for Software Technology, TU Graz, Austria (January 2001); Supervisor: Peter LucasGoogle Scholar
  7. 7.
    Back, R.-J., von Wright, J.: Refinement Calculus: a Systematic Introduction. Graduate Texts in Computer Science. Springer, Heidelberg (1998)zbMATHGoogle Scholar
  8. 8.
    Back, R.-J., von Wright, J.: Enforcing behavior with contracts. Technical Report 373, Turku Centre for Computer Science (November 2000)Google Scholar
  9. 9.
    Back, R.-J., von Wright, J.: Verification and refinement of action contracts. Technical Report 374, Turku Centre for Computer Science (April 2001)Google Scholar
  10. 10.
    Back, R., Mikhajlova, A., von Wright, J.: Reasoning about interactive systems. In: Woodcock, J.C.P., Davies, J., Wing, J.M. (eds.) FM 1999. LNCS, vol. 1709, p. 1460. Springer, Heidelberg (1999)Google Scholar
  11. 11.
    Beck, K.: Extreme Programming Explained: Embrace Change. Addison-Wesley, Reading (1999)Google Scholar
  12. 12.
    Behnia, S., Waeselynck, H.: Test criteria definition for B models. In: Wing, J.M., Woodcock, J.C.P., Davies, J. (eds.) FM 1999. LNCS, vol. 1708, pp. 509–529. Springer, Heidelberg (1999)Google Scholar
  13. 13.
    Beizer, B.: Software Testing Techniques, 2nd edn. Van Nostrand Reinhold, New York (1990)Google Scholar
  14. 14.
    Chen, H.Y., Tse, T.H., Chan, F.T., Chen, T.Y.: In Black and White: An Integrated Approach to Class-Level Testing of Object-Oriented Programs. ACM Transactions on Software Engineering and Methodology 7(3), 250–295 (1998)CrossRefGoogle Scholar
  15. 15.
    DeMillo, R., Lipton, R., Sayward, F.: Hints on test data selection: Help for the practicing programmer. IEEE Computer 11(4), 34–41 (1978)Google Scholar
  16. 16.
    Dick, J., Faivre, A.: Automating the generation and sequencing of test cases from model-based specifications. In: Larsen, P.G., Woodcock, J.C.P. (eds.) FME 1993. LNCS, vol. 670. Springer, Heidelberg (April 1993)Google Scholar
  17. 17.
    Fernandez, J.-C., Jard, C., Jéron, T., Viho, C.: An experiment in automatic generation of test suites for protocols with verification technology. Science of Computer Programming 29(1-2), 123–146 (1997)CrossRefGoogle Scholar
  18. 18.
    Gaudel, M.-C., James, P.R.: Testing algebraic data types and processes: A unifying theory. Formal Aspects of Computing 10(5 & 6), 436–451 (1998)zbMATHCrossRefGoogle Scholar
  19. 19.
    Hamlet, R.G.: Testing programs with the aid of a compiler. IEEE Transactions on Software Engineering 3(4), 279–290 (1977)CrossRefMathSciNetGoogle Scholar
  20. 20.
    Hörl, J., Aichernig, B.K.: Validating voice communication requirements using lightweight formal methods. In: IEEE Software, pp. 21–27 (May/June 2000)Google Scholar
  21. 21.
    Jarke, M., Kurki-Suoni, R. (eds). Special issue on scenario management. IEEE Transactions on Software Engineering 24(12) (1998)Google Scholar
  22. 22.
    Legeard, B., Peureux, F., Utting, M.: Automated boundary testing from Z and B. In: Eriksson, L.-H., Lindsay, P.A. (eds.) FME 2002. LNCS, vol. 2391, p. 21. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  23. 23.
    Morgan, C.C.: Programming from Specifications. Series in Computer Science. Prentice-Hall International, Englewood Cliffs (1990)zbMATHGoogle Scholar
  24. 24.
    Pahl, C.: Interference Analysis for Dependable Systems using Refinement and Abstraction. In: Eriksson, L.-H., Lindsay, P.A. (eds.) FME 2002. LNCS, vol. 2391, p. 330. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  25. 25.
    Stepney, S.: Testing as abstraction. In: Bowen, J.P., Hinchey, M.G. (eds.) ZUM 1995. LNCS, vol. 967. Springer, Heidelberg (1995)Google Scholar
  26. 26.
    Stocks, P.A.: Applying formal methods to software testing. PhD thesis, The Department of computer science, The University of Queensland (1993)Google Scholar
  27. 27.
    Tretmans, J.: Testing concurrent systems: A formal approach. In: Baeten, J.C.M., Mauw, S. (eds.) CONCUR 1999. LNCS, vol. 1664, pp. 46–65. Springer, Heidelberg (1999)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Bernhard K. Aichernig
    • 1
  1. 1.The United Nations University International Institute for Software Technology (UNU/IIST)Macau

Personalised recommendations