Generating Readable Unit Tests for Guava

  • Ermira Daka
  • José Campos
  • Jonathan Dorn
  • Gordon Fraser
  • Westley Weimer
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9275)

Abstract

Unit tests for object-oriented classes can be generated automatically using search-based testing techniques. As the search algorithms are typically guided by structural coverage criteria, the resulting unit tests are often long and confusing, with possible negative implications for developer adoption of such test generation tools, and the difficulty of the test oracle problem and test maintenance. To counter this problem, we integrate a further optimization target based on a model of test readability learned from human annotation data. We demonstrate on a selection of classes from the Guava library how this approach produces more readable unit tests without loss of coverage.

Keywords

Readability Unit testing Automated test generation 

References

  1. 1.
    Buse, R.P., Weimer, W.R.: A metric for software readability. In: Proceedings of the 2008 International Symposium on Software Testing and Analysis, ISSTA 2008, pp. 121–130. ACM, New York, NY, USA (2008)Google Scholar
  2. 2.
    Daka, E., Campos, J., Fraser, G., Dorn, J., Weimer, W.: Modeling readability to improve unit tests. In: European Software Engineering Conference and ACM SIGSOFT Symposium on the Foundations of Software Engineering, ESEC/FSE 2015 (2015)Google Scholar
  3. 3.
    Deb, K., Pratap, A., Agarwal, S., Meyarivan, T.: A fast and elitist multiobjective genetic algorithm: NSGA-II. Trans. Evol. Comp 6(2), 182–197 (2002)CrossRefGoogle Scholar
  4. 4.
    Fraser, G., Arcuri, A.: EvoSuite: automatic test suite generation for object-oriented software. In: European Conference on Foundations of Software Engineering (ESEC/FSE), pp. 416–419 (2011)Google Scholar
  5. 5.
    Posnett, D., Hindle, A., Devanbu, P.: A simpler model of software readability. In: Working Conference on Mining Software Repositories (MSR), pp. 73–82 (2011)Google Scholar
  6. 6.
    Whitley, D., Gordon, V.S., Mathias, K.: Lamarckian evolution, the Baldwin effect and function optimization. In: Davidor, Y., Männer, R., Schwefel, H.-P. (eds.) PPSN 1994. LNCS, vol. 866. Springer, Heidelberg (1994) Google Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  • Ermira Daka
    • 1
  • José Campos
    • 1
  • Jonathan Dorn
    • 2
  • Gordon Fraser
    • 1
  • Westley Weimer
    • 2
  1. 1.Department of Computer ScienceThe University of SheffieldSheffieldUK
  2. 2.University of VirginiaCharlottesvilleUSA

Personalised recommendations