Generating unit tests with descriptive names or: would you name your children thing1 and thing2?

Generating unit tests with descriptive names or: would you name your children thing1 and thing2?
复制标题

DOI:
10.1145/3092703.3092727
复制
发表时间:
2017-07
期刊:
Proceedings of the 26th ACM SIGSOFT International Symposium on Software Testing and Analysis
影响因子:
--
通讯作者:
Ermira Daka;J. Rojas;G. Fraser
Ermira Daka;J. Rojas;G. Fraser
中科院分区:
其他
文献类型:
--
作者:
Ermira Daka;J. Rojas;G. Fraser

文献摘要

被引文献

相似文献

单位测试的名称可以帮助开发人员了解测试的目的和方案,并且在自动生成单元测试的一组单位测试之间导航时,测试名称支持开发人员作为“ Test0”,描述性名称的任何好处都无法给出测试。在本文中,我们提出了一种自动化方法,该方法通过汇总API级覆盖目标来生成自动生成的单元测试的描述性名称。并允许开发人员与47位参与者进行经验评估中的测试,这表明开发人员同意合成的名称,而合成的名称同样具有描述性的作用。与手动派生的名称相比,具有合成名称的测试。
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.