Skip to main content

Jartege: A Tool for Random Generation of Unit Tests for Java Classes

  • Conference paper
Quality of Software Architectures and Software Quality (QoSA 2005, SOQUA 2005)

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

Abstract

This paper presents Jartege, a tool which allows random generation of unit tests for Java classes specified in JML. JML (Java Modeling Language) is a specification language for Java which allows one to write invariants for classes, and pre- and postconditions for operations. As in the JML-JUnit tool, we use JML specifications on the one hand to eliminate irrelevant test cases, and on the other hand as a test oracle. Jartege randomly generates test cases, which consist of a sequence of constructor and method calls for the classes under test. The random aspect of the tool can be parameterized by associating weights to classes and operations, and by controlling the number of instances which are created. The practical use of Jartege is illustrated by a small case study.

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. The JUnit Home Page, http://www.junit.org

  2. Beck, K., Gamma, E.: Test infected: Programmers love writing tests. Java Reports 3(7), 51–56 (1998)

    Google Scholar 

  3. Gannon, J., McMullin, P., Hamlet, R.: Data-abstraction implementation, specification, and testing. ACM Transactions on Programming Languages and Systems 3(3), 211–233 (1981)

    Article  Google Scholar 

  4. Rosenblum, D.S.: Towards a method of programming with assertions. In: International Conference on Software Engineering — ICSE 1992. IEEE Computer Society Press, Los Alamitos (1992)

    Google Scholar 

  5. Meyer, B.: Object-Oriented Software Construction. Prentice-Hall, Englewood Cliffs (1988)

    Google Scholar 

  6. Meyer, B.: Applying design by contract. IEEE Computer 25(10), 40–51 (1992)

    Google Scholar 

  7. Gaudel, M.C.: Testing can be formal too. In: Mosses, P.D., Schwartzbach, M.I., Nielsen, M. (eds.) CAAP 1995, FASE 1995, and TAPSOFT 1995. LNCS, vol. 915, pp. 82–96. Springer, Heidelberg (1995)

    Google Scholar 

  8. Dick, J., Faivre, A.: Automating the generation and sequencing of test cases from model-based specifications. In: Larsen, P., Woodcock, J.C.P. (eds.) FME 1993. LNCS, vol. 670, pp. 268–284. Springer, Heidelberg (1993)

    Chapter  Google Scholar 

  9. Van Aertryck, L., Benveniste, M., Le Métayer, D.: Casting: a formally based software test generation method. In: Proceedings of the First IEEE Internatinal Conference on Formal Engineering Methods — ICFEM 1997, Hiroshima, Japan, November 1997, pp. 101–111 (1997)

    Google Scholar 

  10. Legeard, B., Peureux, F., Utting, M.: Automated boundary testing from Z and B. In: Eriksson, L.-H., Lindsay, P.A. (eds.) FME 2002. LNCS, vol. 2391, pp. 21–40. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  11. Myers, G.J.: The Art of Software Testing. John Wiley and Sons, New York (1994)

    Google Scholar 

  12. Duran, J.W., Ntafos, S.C.: An evaluation of random testing. IEEE Transactions on Software Engineering 10(4), 438–444 (1984)

    Article  Google Scholar 

  13. Hamlet, D., Taylor, R.: Partition testing does not inspire confidence. IEEE Transactions on Software Engineering 16 (1990)

    Google Scholar 

  14. Ntafos, S.C.: On comparisons of random, partition, and proportional partition testing. IEEE Transactions on Software Engineering 27, 949–960 (2001)

    Article  Google Scholar 

  15. Frankl, P.G., Hamlet, R.G., LittleWood, B., Strigini, L.: Evaluating testing methods by delivered reliability. IEEE Transactions on Software Engineering 24, 586–601 (1998)

    Article  Google Scholar 

  16. Hamlet, R.: Random testing. In: Marciniak, J. (ed.) Encyclopedia of Software Engineering, pp. 970–978. Wiley, Chichester (1994)

    Google Scholar 

  17. Weyuker, E.J., Jeng, B.: Analyzing partition testing strategies. IEEE Transactions on Software Engineering 17, 703–711 (1991)

    Article  Google Scholar 

  18. Beck, K.: Embracing change with extreme programming. IEEE Computer 32, 70–77 (1999)

    Google Scholar 

  19. Beck, K.: Extreme Programming Explained. Addison Wesley, Reading (2000)

    Google Scholar 

  20. The Java Modeling Language (JML) Home Page, http://www.cs.iastate.edu/~leavens/JML

  21. Leavens, G.T., Baker, A.L., Ruby, C.: Preliminary Design of JML: A Behavioral Interface Specification Language for Java. Department of Computer Science, Iowa State University (1998–2003)

    Google Scholar 

  22. Leavens, G.T., Poll, E., Clifton, C., Cheon, Y., Ruby, C.: JML Reference Manual (Draft) (April 2003)

    Google Scholar 

  23. Burdy, L., Cheon, Y., Cok, D.R., Ernst, M., Kiniry, J., Leavens, G.T., Rustan, K., Leino, M., Poll, E.: An overview of JML tools and applications. Technical Report NIII-R0309, Department of Computer Science, University of Nijmegen (March 2003)

    Google Scholar 

  24. Cheon, Y., Leavens, G.T.: A runtime assertion checker for the Java Modeling Language. In: Arabnia, H.R., Mun, Y. (eds.) International Conference on Software Engineering Research and Practice — SERP2002, Las Vegas, Nevada, pp. 322–328 (2002)

    Google Scholar 

  25. Cheon, Y., Leavens, G.T.: A simple and practical approach to unit testing: The JML and jUnit way. In: Magnusson, B. (ed.) ECOOP 2002. LNCS, vol. 2374, pp. 231–255. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  26. Parissis, I.: Test de logiciels synchrones spécifiés en Lustre. PhD thesis, Grenoble, France (1996)

    Google Scholar 

  27. du Bousquet, L., Ouabdesselam, F., Richier, J.L., Zuanon, N.: Lutess: a specification-driven testing environment for synchronous software. In: International Conference on Software Engineering — ICSE 1999. ACM Press, Los Angeles (1999)

    Google Scholar 

  28. du Bousquet, L., Zuanon, N.: An overview of Lutess: a specification-based tool for testing synchronous software. In: 14th IEEE International Conference on Automated Software Engineering — ASE 1999, pp. 208–215 (1999)

    Google Scholar 

  29. Labiche, Y., Thévenod-Fosse, P., Waeselynck, H., Durand, M.H.: Testing levels for object-oriented software. In: Proceedings of the 22nd International Conference on Software Engineering — ICSE 2000, Limerick, Ireland, pp. 136–145. ACM, Los Alamitos (2000)

    Chapter  Google Scholar 

  30. Boyapati, C., Khurshid, S., Marinov, D.: Korat: Automated testing based on Java predicates. In: Proceedings of the International Symposium on Software Testing and Analysis — ISSTA 2002, Rome, July 2002, pp. 123–133 (2002)

    Google Scholar 

  31. Ledru, Y.: The TOBIAS test generator and its adaptation to some ASE challenges (position paper). In: Workshop on the State of the Art in Automated Software Engineering, ICS Technical Report UCI-ICS-02-17, University of California, Irvine, USA (2002)

    Google Scholar 

  32. Maury, O., Ledru, Y., Bontron, P., du Bousquet, L.: Using TOBIAS for the automatic generation of VDM test cases. In: Eriksson, L.-H., Lindsay, P.A. (eds.) FME 2002. LNCS, vol. 2391, pp. 41–56. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  33. Jéron, T., Morel, P.: Test generation derived from model-checking. In: Halbwachs, N., Peled, D.A. (eds.) CAV 1999. LNCS, vol. 1633, pp. 108–121. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  34. du Bousquet, L., Lanet, J.L., Ledru, Y., Maury, O., Oriat, C.: A case study in JML-based software validation. In: 19th IEEE International Conference on Automated Software Engineering, Austria — ASE 2004, pp. 294–297 (2004)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Oriat, C. (2005). Jartege: A Tool for Random Generation of Unit Tests for Java Classes. In: Reussner, R., Mayer, J., Stafford, J.A., Overhage, S., Becker, S., Schroeder, P.J. (eds) Quality of Software Architectures and Software Quality. QoSA SOQUA 2005 2005. Lecture Notes in Computer Science, vol 3712. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11558569_18

Download citation

  • DOI: https://doi.org/10.1007/11558569_18

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-29033-9

  • Online ISBN: 978-3-540-32056-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics