Skip to main content

An Approach for Class Testing from Class Contracts

  • Conference paper
Automated Technology for Verification and Analysis (ATVA 2010)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6252))

Abstract

Adequate testing of a class requires testing valid and invalid sequences of class method interactions. In this paper, we show that class contracts can be used to generate effective state based unit tests algorithmically for testing meaningful interactions between methods. Using an abstract state configuration for the object and an initial abstract state, we incrementally search for the methods those can be invoked in the current state and compute resulting abstract states. The same is repeated for each newly generated abstract state till no more new abstract states are generated. This search generates a directed graph from which test sequences can easily be obtained. We applied the proposed approach to test three Java programs seeded with mutation faults and obtained high mutation scores.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Antoniol, G., Briand, L.C., Penta, M.D., Labiche, Y.: A case study using the round-trip strategy for state-based class testing. In: ISSRE 2002: Proceedings of the 13th International Symposium on Software Reliability Engineering, Washington, DC, USA, pp. 269–279. IEEE Computer Society, Los Alamitos (2002)

    Chapter  Google Scholar 

  2. AsmL Home Page, http://research.microsoft.com/en-us/projects/asml/ (accessed March 2010)

  3. Binder, R.V.: Testing Object-Oriented Systems Models, Patterns, and Tools. Addison-Wesley, Reading (1999)

    Google Scholar 

  4. Briand, L.C., Penta, M.D., Labiche, Y.: Assessing and improving state-based class testing: A series of experiments. IEEE Trans. Softw. Eng. 30(11), 770–793 (2004)

    Article  Google Scholar 

  5. Chow, T.S.: Testing software design modeled by finite-state machines. IEEE Trans. Softw. Eng. 4(3), 178–187 (1978)

    Article  MATH  Google Scholar 

  6. Ciupa, I., Leitner, A., Oriol, M., Meyer, B.: Experimental assessment of random testing for object-oriented software. In: ISSTA 2007: Proceedings of the 2007 International Symposium on Software Testing and Analysis, pp. 84–94. ACM Press, New York (2007)

    Chapter  Google Scholar 

  7. Gao, J.Z., Kung, D.C., Hsia, P., Toyoshima, Y., Chen, C.: Object state testing for object-oriented programs. In: COMPSAC 1995: Proceedings of the 19th International Computer Software and Applications Conference, Washington, DC, USA, pp. 232–238. IEEE Computer Society, Los Alamitos (1995)

    Google Scholar 

  8. Grieskamp, W., Gurevich, Y., Schulte, W., Veanes, M.: Generating finite state machines from abstract state machines. In: ISSTA 2002: Proceedings of the 2002 ACM SIGSOFT International Symposium on Software Testing and Analysis, pp. 112–122. ACM Press, New York (2002)

    Google Scholar 

  9. Gupta, A., Raj, A.: Strengthening method contracts for objects. In: APSEC 2006: Proceedings of the XIII Asia Pacific Software Engineering Conference, Washington, DC, USA, pp. 233–242. IEEE Computer Society, Los Alamitos (2006)

    Chapter  Google Scholar 

  10. Helm, R., Holland, I.M., Gangopadhyay, D.: Contracts: specifying behavioral compositions in object-oriented systems. In: OOPSLA/ECOOP 1990: Proceedings of the European Conference on Object-Oriented Programming/Object-Oriented Programming Systems, Languages, and Applications, pp. 169–180. ACM Press, New York (1990)

    Chapter  Google Scholar 

  11. Hoffman, D.M., Strooper, P.A.: ClassBench: A framework for automated class testing. Software Practice and Experience 27(5), 573–597 (1997)

    Article  Google Scholar 

  12. JML Homepage, http://www.eecs.ucf.edu/~leavens/JML/ (accessed March 2010)

  13. JUnit Home Page, http://www.junit.org (accessed March 2010)

  14. Kim, S., Clark, J.A., McDermid, J.A.: The rigorous generation of Java mutation operators using HAZOP. In: Proceedings of ICSSEA, pp. 9–10 (1999)

    Google Scholar 

  15. Kung, D., Lu, Y., Venugopalan, N., Hsia, P., Toyoshima, Y., Chen, C., Gao, J.: Object state testing and fault analysis for reliable software systems. In: ISSRE 1996: Proceedings of the The Seventh International Symposium on Software Reliability Engineering, Washington, DC, USA, p. 76. IEEE Computer Society, Los Alamitos (1996)

    Chapter  Google Scholar 

  16. Lingampally, R., Gupta, A., Jalote, P.: A multipurpose code coverage tool for Java. In: HICSS 2007: Proceedings of 40th Annual Hawaii International Conference on System Sciences; Minitrack on Automated Software Testing and Analysis: Techniques, Practices and Tools, pp. 261–270. IEEE Computer Society, Los Alamitos (2007)

    Google Scholar 

  17. Meyer, B.: Applying “design by contract”. Computer 25(10), 40–51 (1992)

    Article  Google Scholar 

  18. Mouchawrab, S., Briand, L.C., Labiche, Y.: Assessing, comparing, and combining statechart-based testing and structural testing: An experiment. In: ESEM 2007: Proceedings of the 1st Symposium on Empirical Software Engineering & Measurements, Washington, DC, USA, pp. 41–50. IEEE Computer Society, Los Alamitos (2007)

    Google Scholar 

  19. Object-Z Home Page, http://www.itee.uq.edu.au/~smith/objectz.html (accessed March 2010)

  20. OCL 2.0 Specifications, http://www.omg.org/docs/ptc/05-06-06.pdf (accessed March 2010)

  21. Offutt, A.J., Liu, S., Abdurazik, A., Ammann, P.: Generating test data from state-based specifications. Jour. Soft. Test., Veri. and Rel. 13(1), 25–53 (2003)

    Article  Google Scholar 

  22. Paradkar, A.: Towards model-based generation of self-priming and self-checking conformance tests for interactive systems. In: SAC 2003: Proceedings of the 2003 ACM Symposium on Applied Computing, pp. 1110–1117. ACM Press, New York (2003)

    Google Scholar 

  23. Smith, M.D., Robson, D.J.: Object-oriented programming-the problems of validation. In: ICSM 1990: Proceedings of the Seventh International Conference on Software Maintenance, pp. 272–281 (1990)

    Google Scholar 

  24. Turner, C.D., Robson, D.J.: The state-based testing of object-oriented programs. In: ICSM 1993: Proceedings of the International Conference on Software Maintenance, Washington, DC, USA, pp. 302–310. IEEE Computer Society, Los Alamitos (1993)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Gupta, A. (2010). An Approach for Class Testing from Class Contracts. In: Bouajjani, A., Chin, WN. (eds) Automated Technology for Verification and Analysis. ATVA 2010. Lecture Notes in Computer Science, vol 6252. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-15643-4_16

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-15643-4_16

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-15642-7

  • Online ISBN: 978-3-642-15643-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics