Generating Readable Unit Tests for Guava

E. Daka, J. Campos, G. Fraser, J. Dorn, and W. Weimer
Symposium on Search-Based Software Engineering (SSBSE), 2015


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.


  author = {Daka, Ermira and Campos, Jos{\'e} and Dorn, Jonathan and
  Fraser, Gordon and Weimer, Westley},
  title = {Generating Readable Unit Tests for Guava},
  booktitle = {Search-Based Software Engineering},
  series = {Lecture Notes in Computer Science},
  year = {2015},
  isbn = {978-3-319-22182-3},
  volume = {9275},
  editor = {Barros, M{\'a}rcio and Labiche, Yvan},
  doi = {10.1007/978-3-319-22183-0_17},
  url = {},
  publisher = {Springer International Publishing},
  keywords = {Readability; Unit testing; Automated test generation},
  pages = {235-241},