Automated Test Generation for Java Generics
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.
Keywordsautomated test generation unit testing random testing search-based testing EvoSuite
Unable to display preview. Download preview PDF.
- 3.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)Google Scholar
- 4.Fraser, G., Arcuri, A.: Sound empirical evidence in software testing. In: ACM/IEEE International Conference on Software Engineering (ICSE), pp. 178–188 (2012)Google Scholar
- 7.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)Google Scholar
- 9.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)Google Scholar
- 11.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)Google Scholar
- 12.Parnin, C., Bird, C., Murphy-Hill, E.: Adoption and use of Java generics. Empirical Software Engineering, 1–43 (2012)Google Scholar
- 13.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)Google Scholar