Skip to main content

GenUTest: A Unit Test and Mock Aspect Generation Tool

  • Conference paper
Hardware and Software: Verification and Testing (HVC 2007)

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

Included in the following conference series:

Abstract

Unit testing plays a major role in the software development process. It enables the immediate detection of bugs introduced into a unit whenever code changes occur. Hence, unit tests provide a safety net of regression tests and validation tests which encourage developers to refactor existing code. Nevertheless, not all software systems contain unit tests. When changes to such software are needed, writing unit tests from scratch might not be cost effective.

In this paper we propose a technique which automatically generates unit tests for software that does not have such tests. We have implemented GenUTest, a tool which captures and logs inter-object interactions occurring during the execution of Java programs. These interactions are used to generate JUnit tests. They also serve in generating mock aspects – mock object like entities, which assist the testing process. The interactions are captured using the aspect oriented language AspectJ.

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. Andrews, J.H., Haldar, S., Lei, Y., Li, F.C.H.: Tool support for randomized unit testing. In: Proceedings of the 1st International Workshop on Random Testing, pp. 36–45 (2006)

    Google Scholar 

  2. Boshernitsan, M., Doong, R., Savoia, A.: From Daikon to Agitator: Lessons and challenges in building a commercial tool for developer testing. In: Proceedings of the 2006 International Symposium on Software Testing and Analysis, pp. 169–180 (2006)

    Google Scholar 

  3. Csallner, C., Smaragdakis, Y.: JCrasher: An automatic robustness tester for Java. Software Practice and Experience 34(11), 1025–1050 (2004)

    Article  Google Scholar 

  4. d’Amorim, M., Pacheco, C., Xie, T., Marinov, D., Ernst, M.: An empirical comparison of automated generation and classification techniques for object-oriented unit testing. In: Proceedings 21st IEEE/ACM International Conference on Automated Software Engineering (ASE 2006), pp. 59–68 (September 2006)

    Google Scholar 

  5. Elbaum, S., Chin, H.N., Dwyer, M.B., Dokulil, J.: Carving differential unit test cases from system test cases. In: Proceedings of the 14th ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 253–264 (2006)

    Google Scholar 

  6. Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading (2000)

    Google Scholar 

  7. Husted, T., Massol, V.: JUnit in Action. Manning Publications Co. (2003)

    Google Scholar 

  8. Laddad, R.: AspectJ in Action: Practical Aspect-Oriented Programming. Manning, (2003)

    Google Scholar 

  9. Mackinnon, T., Freeman, S., Craig, P.: Endo-testing: unit testing with mock objects. In: Extreme Programming Examined, pp. 287–301. Addison-Wesley, Reading (2001)

    Google Scholar 

  10. Oriat, C.: Jartege: A tool for random generation of unit tests for Java classes. In: Reussner, R., et al. (eds.) QoSA 2005 and SOQUA 2005. LNCS, vol. 3712, pp. 242–256. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  11. Orso, A., Kennedy, B.: Selective capture and replay of program executions. In: Proceedings of the 2005 Workshop on Dynamic Analysis, pp. 1–7 (2005)

    Google Scholar 

  12. Pacheco, C., Ernst, M.: Eclat: Automatic generation and classification of test inputs. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 504–527. Springer, Heidelberg (July 25–29, 2005)

    Google Scholar 

  13. Pasternak, B.: GenUTest: A unit test and mock aspect generation tool. Master’s thesis, Tel-Aviv University (in preparation, 2007)

    Google Scholar 

  14. Saff, D., Artzi, S., Perkins, J., Ernst, M.: Automated test factoring for Java. In: Conference of Automated Software Engineering (ASE), pp. 114–123 (2005)

    Google Scholar 

  15. van Vliet, H.: Software Engineering: Principles and Practice, 2nd edn. John Wiley & Sons, Inc., New York (2000)

    Google Scholar 

  16. Visser, W., Pǎsǎreanu, C.S., Khurshid, S.: Test input generation with Java PathFinder. In: Proceedings of the 2004 ACM SIGSOFT International Symposium on Software Testing and Analysis, pp. 97–107 (2004)

    Google Scholar 

  17. Xie, T., Marinov, D., Notkin, D.: Rostra: A framework for detecting redundant object-oriented unit tests. In: Proceedings of the 19th IEEE International Conference on Automated Software Engineering (ASE), pp. 196–205 (September 2004)

    Google Scholar 

  18. Xie, T., Marinov, D., Schulte, W., Notkin, D.: Symstra: A framework for generating object-oriented unit tests using symbolic execution. In: Halbwachs, N., Zuck, L.D. (eds.) TACAS 2005. LNCS, vol. 3440, Springer, Heidelberg (2005)

    Google Scholar 

  19. Yuan, H., Xie, T.: Substra: A framework for automatic generation of integration tests. In: Proceedings of the 2006 International Workshop on Automation of Software Test, pp. 64–70 (2006)

    Google Scholar 

  20. The AspectJ Project. (Visited July 2007), http://www.eclipse.org/aspectj

  21. Easy Mock (Visited July 2007), http://www.easymock.org

  22. EclEmma (Visited November 2007), http://www.eclemma.org

  23. Extreme Programming (Visited July 2007), http://www.extremeprogramming.org

  24. JODE (Java Optimize and Decompile Environment) (Visited November 2007), http://jode.sourceforge.net

  25. JUnit (Visited July 2007), http://www.junit.org

  26. NanoXML (Visited July 2007), http://nanoxml.cyberelf.be

  27. Virtual Mock Objects using AspectJ with JUnit (Visited July 2007), http://www.xprogramming.com/xpmag/virtualMockObjects.htm

  28. XStream 1.2.1 (Visited July 2007), http://xstream.codehaus.org

Download references

Author information

Authors and Affiliations

Authors

Editor information

Karen Yorav

Rights and permissions

Reprints and permissions

Copyright information

© 2008 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Pasternak, B., Tyszberowicz, S., Yehudai, A. (2008). GenUTest: A Unit Test and Mock Aspect Generation Tool. In: Yorav, K. (eds) Hardware and Software: Verification and Testing. HVC 2007. Lecture Notes in Computer Science, vol 4899. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-77966-7_20

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-77966-7_20

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-77964-3

  • Online ISBN: 978-3-540-77966-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics