Abstract
Several approaches exist to automatically derive test cases that check the conformance of the implementation of abstract data types (ADTs) with respect to their specification. However, they lack support for the testing of implementations of ADTs defined by generic classes. In this paper, we present a novel technique to automatically derive, from specifications, unit test cases for Java generic classes that, in addition to the usual testing data, encompass implementations for the type parameters. The proposed technique relies on the use of Alloy Analyzer to find model instances for each test goal. JUnit test cases and Java implementations of the parameters are extracted from these model instances.
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
Andrade, F., Faria, J.P., Lopes, A., Paiva, A.: Specification-driven unit test generation for Java generic classes (2011), http://paginas.fe.up.pt/~jpf/research/TR-QUEST-2011-01.pdf
Bidoit, M., Mosses, P.: CASL User Manual. LNCS, vol. 2900, pp. 3–9. Springer, Heidelberg (2004)
Chen, H.Y., Tse, T.H., Chen, T.Y.: TACCLE: a methodology for object-oriented software testing at the class and cluster levels. ACM Trans. Softw. Eng. Methodol. 10, 56–109 (2001)
Crispim, P., Lopes, A., Vasconcelos, V.T.: Runtime Verification for Generic Classes with CONGU2. In: Davies, J. (ed.) SBMF 2010. LNCS, vol. 6527, pp. 33–48. Springer, Heidelberg (2011)
Doong, R.K., Frankl, P.G.: The ASTOOT approach to testing object-oriented programs. ACM Trans. Softw. Eng. Methodol. 3, 101–130 (1994)
Ehrig, H., Mahr, B.: Fundamentals of Algebraic Specification 1: Equations und Initial Semantics. Monographs in Theoretical Computer Science (EATCS), vol. 6. Springer, Heidelberg (1985)
Futatsugi, K., Goguen, J.A., Jouannaud, J.-P., Meseguer, J.: Principles of OBJ2. In: Proceedings of the 12th POPL, pp. 52–66. ACM, New York (1985)
Gaudel, M.-C., Le Gall, P.: Testing Data Types Implementations from Algebraic Specifications. In: Hierons, R.M., Bowen, J.P., Harman, M. (eds.) FORTEST. LNCS, vol. 4949, pp. 209–239. Springer, Heidelberg (2008)
Hein, J.L.: Discrete Structures, Logic, and Computability. Jones & Bartlett Publishers (2009)
Hoffmann, M.R.: Ecclema: Java code coverage tool for Eclipse, http://www.eclemma.org/
Huges, M., Stotts, D.: Daistish: Systematic algebraic testing for OO programs in the presence of side-effects. In: Proc. ISSTV, pp. 53–61. ACM (1996)
Irvine, S.A., Pavlinic, T., Trigg, L., Cleary, J.G., Inglis, S., Utting, M.: Jumble Java byte code to measure the effectiveness of unit tests (2007), http://jumble.sourceforge.net/
Jackson, D.: Software Abstractions: Logic, Language, and Analysis. The MIT Press (2006)
Mackinnon, T., Freeman, S., Craig, P.: Endotesting: Unit testing with mock objects. In: eXtreme Programming and Flexible Processes in Software Engineering – XP 2000 (2000)
Nunes, I., Lopes, A., Vasconcelos, V.T.: Bridging the Gap between Algebraic Specification and Object-Oriented Generic Programming. In: Bensalem, S., Peled, D.A. (eds.) RV 2009. LNCS, vol. 5779, pp. 115–131. Springer, Heidelberg (2009)
The Stanford Natural Language Processing Group, http://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/util/package-tree.html
Yu, B., King, L., Zhu, H., Zhou, B.: Testing Java components based on algebraic specifications. In: Proc. International Conference on Software Testing, Verification and Validation, pp. 190–198. IEEE (2008)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Rebello de Andrade, F., Faria, J.P., Lopes, A., Paiva, A.C.R. (2012). Specification-Driven Unit Test Generation for Java Generic Classes. In: Derrick, J., Gnesi, S., Latella, D., Treharne, H. (eds) Integrated Formal Methods. IFM 2012. Lecture Notes in Computer Science, vol 7321. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-30729-4_21
Download citation
DOI: https://doi.org/10.1007/978-3-642-30729-4_21
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-30728-7
Online ISBN: 978-3-642-30729-4
eBook Packages: Computer ScienceComputer Science (R0)