Abstract
Software testing research has resulted in effective white-box test generation techniques that can produce unit test suites achieving high code coverage. However, research prototypes usually only cover subsets of the basic programming language features, thus inhibiting practical use and evaluation. One feature commonly omitted are Java’s generics, which have been present in the language since 2004. In Java, a generic class has type parameters and can be instantiated for different types; for example, a collection can be parameterized with the type of values it contains. To enable test generation tools to cover generics, two simple changes are required to existing approaches: First, the test generator needs to use Java’s extended reflection API to retrieve the little information that remains after type erasure. Second, a simple static analysis can identify candidate classes for type parameters of generic classes. The presented techniques are implemented in the EvoSuite test data generation tool and their feasibility is demonstrated with an example.
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
Ali, S., Briand, L., Hemmati, H., Panesar-Walawege, R.: A systematic review of the application and empirical investigation of search-based test-case generation. IEEE Transactions on Software Engineering (TSE) 36(6), 742–762 (2010)
Anand, S., Păsăreanu, C.S., Visser, W.: JPF–SE: A symbolic execution extension to java pathFinder. In: Grumberg, O., Huth, M. (eds.) TACAS 2007. LNCS, vol. 4424, pp. 134–138. Springer, Heidelberg (2007)
Fraser, G., Arcuri, A.: EvoSuite: Automatic test suite generation for object-oriented software. In: ACM Symposium on the Foundations of Software Engineering (FSE), pp. 416–419 (2011)
Fraser, G., Arcuri, A.: Sound empirical evidence in software testing. In: ACM/IEEE International Conference on Software Engineering (ICSE), pp. 178–188 (2012)
Fraser, G., Arcuri, A.: Whole test suite generation. IEEE Transactions on Software Engineering 39(2), 276–291 (2013)
Fraser, G., Zeller, A.: Mutation-driven generation of unit tests and oracles. IEEE Transactions on Software Engineering (TSE) 28(2), 278–292 (2012)
Godefroid, P., Klarlund, N., Sen, K.: Dart: directed automated random testing. In: ACM Conference on Programming language design and implementation (PLDI), pp. 213–223 (2005)
Harman, M., Mansouri, S.A., Zhang, Y.: Search-based software engineering: Trends, techniques and applications. ACM Computing Surveys (CSUR) 45(1), 11 (2012)
Islam, M., Csallner, C.: Dsc+mock: A test case + mock class generator in support of coding against interfaces. In: International Workshop on Dynamic Analysis (WODA), pp. 26–31 (2010)
McMinn, P.: Search-based software test data generation: A survey. Software Testing, Verification and Reliability 14(2), 105–156 (2004)
Pacheco, C., Lahiri, S.K., Ernst, M.D., Ball, T.: Feedback-directed random test generation. In: ACM/IEEE International Conference on Software Engineering (ICSE), pp. 75–84 (2007)
Parnin, C., Bird, C., Murphy-Hill, E.: Adoption and use of Java generics. Empirical Software Engineering, 1–43 (2012)
Tillmann, N., de Halleux, N.J.: Pex — white box test generation for .NET. In: International Conference on Tests And Proofs (TAP), pp. 134–253 (2008)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this paper
Cite this paper
Fraser, G., Arcuri, A. (2014). Automated Test Generation for Java Generics. In: Winkler, D., Biffl, S., Bergsmann, J. (eds) Software Quality. Model-Based Approaches for Advanced Software and Systems Engineering. SWQD 2014. Lecture Notes in Business Information Processing, vol 166. Springer, Cham. https://doi.org/10.1007/978-3-319-03602-1_12
Download citation
DOI: https://doi.org/10.1007/978-3-319-03602-1_12
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-03601-4
Online ISBN: 978-3-319-03602-1
eBook Packages: Computer ScienceComputer Science (R0)