Generating unit tests with descriptive names or: would you name your children thing1 and thing2?
Authors:
Open Access
- 10 July 2017
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 57-67
Abstract
The name of a unit test helps developers to understand the purpose and scenario of the test, and test names support developers when navigating amongst sets of unit tests. When unit tests are generated automatically, however, they tend to be given non-descriptive names such as “test0”, which provide none of the benefits a descriptive name can give a test. The underlying challenge is that automatically generated tests typically do not represent real scenarios and have no clear purpose other than covering code, which makes naming them di cult. In this paper, we present an automated approach which generates descriptive names for automatically generated unit tests by summarizing API-level coverage goals. The tests are optimized to be short, descriptive of the test, have a clear relation to the covered code under test, and allow developers to uniquely distinguish tests in a test suite. An empirical evaluation with 47 participants shows that developers agree with the synthesized names, and the synthesized names are equally descriptive as manually written names. Study participants were even more accurate and faster at matching code and tests with synthesized names compared to manually derived names.Keywords
Funding Information
- Engineering and Physical Sciences Research Council (EP/N023978/1)
This publication has 43 references indexed in Scilit:
- A Large-Scale Evaluation of Automated Unit Test Generation Using EvoSuiteACM Transactions on Software Engineering and Methodology, 2014
- Instance Generator and Problem Representation to Improve Object Oriented Code CoverageIEEE Transactions on Software Engineering, 2014
- T3, a Combinator-Based Random Testing Tool for Java: Benchmarking2014
- T3, a Combinator-Based Random Testing Tool for Java: Benchmarking2014
- Debugging Method Names2009
- Pex–White Box Test Generation for .NET2008
- Augmenting Automatically Generated Unit-Test Suites with Regression Oracle Checking2006
- Evolutionary testing of classesACM SIGSOFT Software Engineering Notes, 2004
- JCrasher: an automatic robustness tester for JavaSoftware: Practice and Experience, 2004
- Preliminary guidelines for empirical research in software engineeringIEEE Transactions on Software Engineering, 2002