arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2103.14781cs.SE
收藏

班级特征与考试气味关系的实证研究

An empirical study into the relationship between class features and test smells

Amjed Tahir, Steve Counsell, Stephen G. MacDonell

摘要:

虽然大量的先前研究已经调查了生产代码的形式和性质,但相对较少关注测试代码的特性,特别是测试代码中的测试气味。在本文中,我们探讨了生产代码属性(在类级别)和一组测试气味之间的关系,在五个开源系统。具体来说,我们检查生产类的复杂性属性是否可以用作相关单元测试中测试气味存在的预测因子。我们的结果,来自975个生产类单元测试对的分析,表明生产类的圈复杂度(CC)和加权方法(WMC)是其相关的单元测试中存在气味的强有力的指标。生产类中方法缺乏内聚(LCOM)似乎也是测试气味存在的一个很好的指示器。也许更重要的是,所有这三个指标似乎都是特定测试气味的良好指标,特别是Eager Test和Duplicated Code。另一方面,遗传树的深度(DIT)与测试气味的发生率没有显着相关。这些结果对大规模软件开发具有重要意义,特别是在组织越来越多地使用、采用或改编开源代码作为其开发战略的一部分,并且需要确保类和方法尽可能简单的情况下。

英文摘要:

While a substantial body of prior research has investigated the form and nature of production code, comparatively little attention has examined characteristics of test code, and, in particular, test smells in that code. In this paper, we explore the relationship between production code properties (at the class level) and a set of test smells, in five open source systems. Specifically, we examine whether complexity properties of a production class can be used as predictors of the presence of test smells in the associated unit test. Our results, derived from the analysis of 975 production class-unit test pairs, show that the Cyclomatic Complexity (CC) and Weighted Methods per Class (WMC) of production classes are strong indicators of the presence of smells in their associated unit tests. The Lack of Cohesion of Methods in a production class (LCOM) also appears to be a good indicator of the presence of test smells. Perhaps more importantly, all three metrics appear to be good indicators of particular test smells, especially Eager Test and Duplicated Code. The Depth of the Inheritance Tree (DIT), on the other hand, was not found to be significantly related to the incidence of test smells. The results have important implications for large-scale software development, particularly in a context where organizations are increasingly using, adopting or adapting open source code as part of their development strategy and need to ensure that classes and methods are kept as simple as possible.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑