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

理解测试代码中的自我承认技术债务:一项实证研究

Understanding Self-Admitted Technical Debt in Test Code: An Empirical Study

Nara Institute of Science and Technology(奈良先端科学技术大学院大学);Hangzhou Dianzi University(杭州电子科技大学)

Ibuki Nakamura, Yutaro Kashiwa, Bin Lin, Hajimu Iida

AI总结:

本研究通过实证分析揭示测试代码中自我承认技术债务的分布和类型,并开发机器学习模型进行自动分类,发现其与测试质量无直接关联。

摘要:

开发者常常选择更容易但非最优的实现方式以满足截止日期或创建快速原型,这导致了额外的努力,即技术债务,以在以后改进代码。很多时候,开发者会在代码注释中明确记录技术债务,称为自我承认的技术债务(SATD)。许多研究人员已研究了SATD对软件质量和开发过程不同方面的影响。然而,大多数这些研究集中在生产代码中的SATD,往往忽略了测试代码中的SATD或假设其与生产代码中的SATD有相似特征。事实上,测试代码中也存在大量SATD,许多实例不符合现有生产代码中的分类。本研究旨在填补这一空白,通过研究其分布和类型来揭示测试代码中的SATD本质。此外,还分析了其存在与测试质量之间的关系。我们的实证研究涉及从50个仓库中收集的17,766条SATD注释(14,987条来自生产代码,2,779条来自测试代码)。研究显示,尽管SATD广泛存在于测试代码中,但它并不直接与测试异味相关。我们的研究还提出了测试代码中SATD类型的全面分类,并开发了机器学习模型,根据其类型自动分类SATD注释,以便更方便地管理。我们的结果表明,基于CodeBERT的模型在召回率和F1分数方面优于其他机器学习模型。然而,性能在不同类型的SATD上有所不同。

英文摘要:

Developers often opt for easier but non-optimal implementation to meet deadlines or create rapid prototypes, leading to additional effort known as technical debt to improve the code later. Oftentimes, developers explicitly document the technical debt in code comments, referred to as Self-Admitted Technical Debt (SATD). Numerous researchers have investigated the impact of SATD on different aspects of software quality and development processes. However, most of these studies focus on SATD in production code, often overlooking SATD in the test code or assuming that it shares similar characteristics with SATD in production code. In fact, a significant amount of SATD is also present in the test code, with many instances not fitting into existing categories for the production code. This study aims to fill this gap and disclose the nature of SATD in the test code by examining its distribution and types. Moreover, the relation between its presence and test quality is also analyzed. Our empirical study, involving 17,766 SATD comments (14,987 from production code, 2,779 from test code) collected from 50 repositories, demonstrates that while SATD widely exists in test code, it is not directly associated with test smells. Our study also presents comprehensive categories of SATD types in the test code, and machine learning models are developed to automatically classify SATD comments based on their types for easier management. Our results show that the CodeBERT-based model outperforms other machine learning models in terms of recall and F1-score. However, the performance varies on different types of SATD.

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

↑