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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
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)
AsmL Home Page, http://research.microsoft.com/en-us/projects/asml/ (accessed March 2010)
Binder, R.V.: Testing Object-Oriented Systems Models, Patterns, and Tools. Addison-Wesley, Reading (1999)
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)
Chow, T.S.: Testing software design modeled by finite-state machines. IEEE Trans. Softw. Eng. 4(3), 178–187 (1978)
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)
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)
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)
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)
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)
Hoffman, D.M., Strooper, P.A.: ClassBench: A framework for automated class testing. Software Practice and Experience 27(5), 573–597 (1997)
JML Homepage, http://www.eecs.ucf.edu/~leavens/JML/ (accessed March 2010)
JUnit Home Page, http://www.junit.org (accessed March 2010)
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)
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)
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)
Meyer, B.: Applying “design by contract”. Computer 25(10), 40–51 (1992)
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)
Object-Z Home Page, http://www.itee.uq.edu.au/~smith/objectz.html (accessed March 2010)
OCL 2.0 Specifications, http://www.omg.org/docs/ptc/05-06-06.pdf (accessed March 2010)
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)
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)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)