paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Measuring the Influence of Incorrect Code on Test Generation

衡量错误代码对测试生成的影响
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 3/10 · 该论文研究 LLM 测试生成受被测代码正确性影响,属于软件测试与 LLM4SE 的实证测量,并非静态分析、形式化验证,也不涉及浮点程序分析或贝叶斯程序分析。虽然使用了较强模型并具有问题驱动的量化结论,但与用户核心研究方向(PL 与 AI 在静态分析/Agentic 程序上的交叉)只有较弱的相邻关系。引用 9 inbox
Dong Huang, Jie M. Zhang, Mark Harman, Mingzhe Du, Heming Cui
crossref: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:首次量化被测代码正确性对 LLM 测试生成的影响:错误代码令测试准确率、覆盖率与缺陷检测显著下降。

人们通常假设,与提示错误的被测代码相比,LLM 在提示正确的被测代码时更容易生成正确的测试用例,但这一效应的大小此前从未被测量。作者对 5 个开源与 6 个闭源语言模型开展大规模实证研究,覆盖 3 个广泛使用的基准数据集,以及来自两个真实数据集的 41 个仓库级真实样例。结果表明:相较于被测代码错误的情形,提示正确代码的 LLM 在测试准确率、代码覆盖率和缺陷检测上分别提升 57%、12% 与 24%;这些结论可从三个基准数据集推广到真实代码,为错误代码生成的测试其缺陷检测率要差 47%。作者还发现,提供自然语言代码描述可带来 +18% 准确率、+4% 覆盖率与 +34% 缺陷检测的提升。基于此,论文给出了面向实践的可操作结论与补救建议。

问题
研究问题是:被测代码本身的正确性会在多大程度上影响 LLM 生成的测试用例质量?这一效应虽被普遍假设,却从未被量化测量。
方法
在 3 个广泛使用的基准数据集和 41 个仓库级真实样例上,对 5 个开源与 6 个闭源语言模型进行大规模实证对比,并额外考察提供自然语言代码描述的影响。
评估
以测试准确率、代码覆盖率和缺陷检测率为指标,比较正确与错误被测代码下的生成测试,并检验结论从基准数据集到真实世界代码的可推广性。
原文摘要(Abstract)

It is natural to suppose that a Large Language Model is more likely to generate correct test cases when prompted with correct code under test, compared to incorrect code under test. However, the size of this effect has never been previously measured, despite its obvious importance for both practicing software engineers and researchers. To answer the question, we conducted a comprehensive empirical study on 5 open source and 6 closed source language models, with 3 widely-used benchmark data sets together with 41 repo-level real-world examples from two different real-world data sets. Our results reveal that, when compared to incorrect code under test, LLMs prompted with correct code achieve improvements in test accuracy, code coverage, and bug detection of 57%, 12%, and 24% respectively. We further show that these scientific conclusions carry over from the three benchmark data sets to the real-world code, where tests generated for incorrect code experience a 47% worse bug detection rate. Finally, we report that improvements of +18% in accuracy, +4% coverage, and +34% in bug detection can be achieved by providing natural language code descriptions. These findings have actionable conclusions. For example, the 47% reduction in real-world bug detection is a clear concern. Fortunately, it is a concern for which our findings about the added value of descriptions offer an immediately actionable remedy.

链接与引用

DOI 原文 · arXiv ·

BibTeX
@inproceedings{paperbot11879,
  title = {Measuring the Influence of Incorrect Code on Test Generation},
  author = {Dong Huang and Jie M. Zhang and Mark Harman and Mingzhe Du and Heming Cui},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3764532}
}