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.
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
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)
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)
Csallner, C., Smaragdakis, Y.: JCrasher: An automatic robustness tester for Java. Software Practice and Experience 34(11), 1025–1050 (2004)
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)
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)
Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading (2000)
Husted, T., Massol, V.: JUnit in Action. Manning Publications Co. (2003)
Laddad, R.: AspectJ in Action: Practical Aspect-Oriented Programming. Manning, (2003)
Mackinnon, T., Freeman, S., Craig, P.: Endo-testing: unit testing with mock objects. In: Extreme Programming Examined, pp. 287–301. Addison-Wesley, Reading (2001)
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)
Orso, A., Kennedy, B.: Selective capture and replay of program executions. In: Proceedings of the 2005 Workshop on Dynamic Analysis, pp. 1–7 (2005)
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)
Pasternak, B.: GenUTest: A unit test and mock aspect generation tool. Master’s thesis, Tel-Aviv University (in preparation, 2007)
Saff, D., Artzi, S., Perkins, J., Ernst, M.: Automated test factoring for Java. In: Conference of Automated Software Engineering (ASE), pp. 114–123 (2005)
van Vliet, H.: Software Engineering: Principles and Practice, 2nd edn. John Wiley & Sons, Inc., New York (2000)
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)
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)
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)
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)
The AspectJ Project. (Visited July 2007), http://www.eclipse.org/aspectj
Easy Mock (Visited July 2007), http://www.easymock.org
EclEmma (Visited November 2007), http://www.eclemma.org
Extreme Programming (Visited July 2007), http://www.extremeprogramming.org
JODE (Java Optimize and Decompile Environment) (Visited November 2007), http://jode.sourceforge.net
JUnit (Visited July 2007), http://www.junit.org
NanoXML (Visited July 2007), http://nanoxml.cyberelf.be
Virtual Mock Objects using AspectJ with JUnit (Visited July 2007), http://www.xprogramming.com/xpmag/virtualMockObjects.htm
XStream 1.2.1 (Visited July 2007), http://xstream.codehaus.org
Author information
Authors and Affiliations
Editor information
Rights 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)