Advertisement

Specification-Driven Unit Test Generation for Java Generic Classes

  • Francisco Rebello de Andrade
  • João P. Faria
  • Antónia Lopes
  • Ana C. R. Paiva
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7321)

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.

Keywords

Model Instance Predicate Symbol Disjunctive Normal Form Abstract Test Alloy Analyzer 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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. 2.
    Bidoit, M., Mosses, P.: CASL User Manual. LNCS, vol. 2900, pp. 3–9. Springer, Heidelberg (2004)zbMATHGoogle Scholar
  3. 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)CrossRefGoogle Scholar
  4. 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. 5.
    Doong, R.K., Frankl, P.G.: The ASTOOT approach to testing object-oriented programs. ACM Trans. Softw. Eng. Methodol. 3, 101–130 (1994)CrossRefGoogle Scholar
  6. 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. 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. 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)CrossRefGoogle Scholar
  9. 9.
    Hein, J.L.: Discrete Structures, Logic, and Computability. Jones & Bartlett Publishers (2009)Google Scholar
  10. 10.
    Hoffmann, M.R.: Ecclema: Java code coverage tool for Eclipse, http://www.eclemma.org/
  11. 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. 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. 13.
    Jackson, D.: Software Abstractions: Logic, Language, and Analysis. The MIT Press (2006)Google Scholar
  14. 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. 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)CrossRefGoogle Scholar
  16. 16.
  17. 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

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Francisco Rebello de Andrade
    • 2
  • João P. Faria
    • 2
    • 3
  • Antónia Lopes
    • 1
  • Ana C. R. Paiva
    • 2
  1. 1.Faculdade de CiênciasUniversidade de LisboaPortugal
  2. 2.Faculdade de EngenhariaUniversidade do PortoPortugal
  3. 3.INESC PortoPortugal

Personalised recommendations