Skip to main content

Specification-Driven Unit Test Generation for Java Generic Classes

  • Conference paper
Book cover Integrated Formal Methods (IFM 2012)

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

Included in the following conference series:

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.

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. 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

  2. Bidoit, M., Mosses, P.: CASL User Manual. LNCS, vol. 2900, pp. 3–9. Springer, Heidelberg (2004)

    MATH  Google Scholar 

  3. 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)

    Article  Google Scholar 

  4. 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)

    Google Scholar 

  5. Doong, R.K., Frankl, P.G.: The ASTOOT approach to testing object-oriented programs. ACM Trans. Softw. Eng. Methodol. 3, 101–130 (1994)

    Article  Google Scholar 

  6. Ehrig, H., Mahr, B.: Fundamentals of Algebraic Specification 1: Equations und Initial Semantics. Monographs in Theoretical Computer Science (EATCS), vol. 6. Springer, Heidelberg (1985)

    Google Scholar 

  7. 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)

    Google Scholar 

  8. 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)

    Chapter  Google Scholar 

  9. Hein, J.L.: Discrete Structures, Logic, and Computability. Jones & Bartlett Publishers (2009)

    Google Scholar 

  10. Hoffmann, M.R.: Ecclema: Java code coverage tool for Eclipse, http://www.eclemma.org/

  11. 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)

    Google Scholar 

  12. 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/

  13. Jackson, D.: Software Abstractions: Logic, Language, and Analysis. The MIT Press (2006)

    Google Scholar 

  14. Mackinnon, T., Freeman, S., Craig, P.: Endotesting: Unit testing with mock objects. In: eXtreme Programming and Flexible Processes in Software Engineering – XP 2000 (2000)

    Google Scholar 

  15. 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)

    Chapter  Google Scholar 

  16. The Stanford Natural Language Processing Group, http://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/util/package-tree.html

  17. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics