Modeling Readability to Improve Unit Tests

E. Daka, J. Campos, G. Fraser, J. Dorn, and W. Weimer
European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering (ESEC/FSE), 2015


Writing good unit tests can be tedious and error prone, but even once they are written, the job is not done: Developers need to reason about unit tests throughout software development and evolution, in order to diagnose test failures, maintain the tests, and to understand code written by other developers. Unreadable tests are more difficult to maintain and lose some of their value to developers. To overcome this problem, we propose a domain-specific model of unit test readability based on human judgements, and use this model to augment automated unit test generation. The resulting approach can automatically generate test suites with both high coverage and also improved readability. In human studies users prefer our improved tests and are able to answer maintenance questions about them 14% more quickly at the same level of accuracy.


  author = {Daka, Ermira and Campos, Jos{\'e} and Fraser, Gordon and Dorn,
  Jonathan and Weimer, Westley},
  title = {Modeling Readability to Improve Unit Tests},
  booktitle = {Proceedings of the 2015 10th Joint Meeting on Foundations
  of Software Engineering},
  series = {ESEC/FSE 2015},
  year = {2015},
  isbn = {978-1-4503-3675-8},
  location = {Bergamo, Italy},
  pages = {107--118},
  numpages = {12},
  url = {},
  doi = {10.1145/2786805.2786838},
  acmid = {2786838},
  publisher = {ACM},
  address = {New York, NY, USA},
  keywords = {Readability, automated test generation, unit testing},