Skip to main content

Automated Test Generation for Java Generics

  • Conference paper

Part of the book series: Lecture Notes in Business Information Processing ((LNBIP,volume 166))

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.

This is a preview of subscription content, log in via an institution.

Buying options

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   49.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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Article  Google Scholar 

  2. 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)

    Chapter  Google Scholar 

  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 

  5. Fraser, G., Arcuri, A.: Whole test suite generation. IEEE Transactions on Software Engineering 39(2), 276–291 (2013)

    Article  Google Scholar 

  6. Fraser, G., Zeller, A.: Mutation-driven generation of unit tests and oracles. IEEE Transactions on Software Engineering (TSE) 28(2), 278–292 (2012)

    Article  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 

  8. Harman, M., Mansouri, S.A., Zhang, Y.: Search-based software engineering: Trends, techniques and applications. ACM Computing Surveys (CSUR) 45(1), 11 (2012)

    Article  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 

  10. McMinn, P.: Search-based software test data generation: A survey. Software Testing, Verification and Reliability 14(2), 105–156 (2004)

    Article  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 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics