Generating Readable Unit Tests for Guava
- Cite this paper as:
- Daka E., Campos J., Dorn J., Fraser G., Weimer W. (2015) Generating Readable Unit Tests for Guava. In: Barros M., Labiche Y. (eds) Search-Based Software Engineering. SSBSE 2015. Lecture Notes in Computer Science, vol 9275. Springer, Cham
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.