Self-admitted technical debt (SATD) refers to comments in which developers explicitly acknowledge code issues, workarounds, or suboptimal solutions. SATD is known to significantly increase software maintenance effort. While extensive research has examined SATD in source code, its presence and impact in test code have received no focused attention, leaving a significant gap in our understanding of how SATD manifests in testing contexts. This study, the first of its kind, investigates SATD in test code by manually analyzing 50,000 comments randomly sampled from 1.6 million comments across 1,000 open-source Java projects. From this sample, after manual analysis and filtering, we identified 615 SATD comments and classified them into 15 distinct categories, building a taxonomy of test code SATD. To investigate whether test code SATD can be detected automatically, we evaluated existing SATD detection tools, as well as both open-source and proprietary LLMs. Among the existing tools, MAT performed the best, albeit with moderate recall. To our surprise, both open-source and proprietary LLMs exhibited poor detection accuracy, primarily due to low precision. These results indicate that neither existing approaches nor current LLMs can reliably detect SATD in test code. Overall, this work provides the first large-scale analysis of SATD in test code, a nuanced understanding of its types, and the limitations of current SATD detection methods. Our findings lay the groundwork for future research on test code-specific SATD.
翻译:自承认技术债务(SATD)是指开发者在注释中明确承认代码问题、变通方案或次优解决方案的现象。已知SATD会显著增加软件维护工作量。尽管已有大量研究探讨了源代码中的SATD,但测试代码中SATD的存在及其影响尚未得到专门关注,这导致我们对SATD在测试环境中如何表现的理解存在重大空白。本研究首次针对测试代码中的SATD展开调查,通过手动分析从1000个开源Java项目的160万条注释中随机抽取的5万条注释。经过人工分析和筛选后,我们从样本中识别出615条SATD注释,并将其归类为15个不同类别,从而构建了测试代码SATD的分类体系。为探究测试代码SATD能否被自动检测,我们评估了现有的SATD检测工具以及开源和专有的大型语言模型。在现有工具中,MAT表现最佳,但召回率仅为中等水平。令人惊讶的是,开源和专有的大型语言模型均表现出较差的检测准确率,主要原因是其精确度较低。这些结果表明,现有方法和当前的大型语言模型均无法可靠地检测测试代码中的SATD。总体而言,本研究首次对测试代码中的SATD进行了大规模分析,深入理解了其类型特征,并揭示了当前SATD检测方法的局限性。我们的发现为未来开展针对测试代码特有SATD的研究奠定了基础。