paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Large Language Models are Few-shot Testers: Exploring LLM-based General Bug Reproduction

大语言模型是少样本测试者:探索基于LLM的通用缺陷复现
ICSE 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)2023匹配度 5/10 · 论文将LLM用于从通用缺陷报告生成复现测试,属于AI/LLM辅助软件工程与程序语言交叉,但并非用户核心关注的静态分析、形式化验证、浮点程序分析或贝叶斯程序分析。其问题驱动、基准评估和数据污染分析有一定参考价值,但方向只是相邻。引用 336 inbox
Sungmin Kang, Juyeon Yoon, Shin Yoo
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出Libro框架,利用大语言模型从通用缺陷报告中生成复现测试,并通过后处理与排序提升有效性。

现有自动测试生成技术多以提高覆盖率或生成探索性输入为目标,难以实现更语义化的目标,例如根据缺陷报告生成复现测试。然而,实证研究表明开源仓库中因issue新增的测试约占项目测试套件规模的28%,缺陷复现对开发者至关重要。由于将缺陷报告中的期望程序语义转化为测试预言十分困难,现有故障复现技术通常仅处理程序崩溃这一小部分缺陷。为从通用缺陷报告中自动生成测试,本文提出Libro框架,使用已被证明能完成代码相关任务的大语言模型(LLM)。由于LLM本身无法执行目标缺陷代码,工作重点放在后处理步骤,以判断LLM何时有效,并按有效性对生成的测试排序。在Defects4J基准上,Libro为750个案例中的251个(33%)生成了失败复现测试,并对149个缺陷将复现测试排在首位。为缓解数据污染,作者还在LLM训练数据截止后提交的31个缺陷报告上评估,Libro为32%的报告生成了复现测试。

问题
如何从通用缺陷报告自动生成复现测试,而不仅限于程序崩溃;难点在于缺陷报告中的期望程序语义难以转化为测试预言。
方法
提出Libro框架,使用大语言模型进行少样本测试生成;由于LLM无法执行目标缺陷代码,重点设计后处理步骤来判断LLM何时有效,并按有效性对生成的测试排序。
评估
在广泛研究的Defects4J基准上评估,Libro为750个案例中的251个生成失败复现测试,并为149个缺陷将复现测试排在首位;同时在LLM训练数据截止后提交的31个缺陷报告上评估以缓解数据污染,成功率为32%。
原文摘要(Abstract)

Many automated test generation techniques have been developed to aid developers with writing tests. To facilitate full automation, most existing techniques aim to either increase coverage, or generate exploratory inputs. However, existing test generation techniques largely fall short of achieving more semantic objectives, such as generating tests to reproduce a given bug report. Reproducing bugs is nonetheless important, as our empirical study shows that the number of tests added in open source repositories due to issues was about 28% of the corresponding project test suite size. Meanwhile, due to the difficulties of transforming the expected program semantics in bug reports into test oracles, existing failure reproduction techniques tend to deal exclusively with program crashes, a small subset of all bug reports. To automate test generation from general bug reports, we propose Libro, a framework that uses Large Language Models (LLMs), which have been shown to be capable of performing code-related tasks. Since LLMs themselves cannot execute the target buggy code, we focus on post-processing steps that help us discern when LLMs are effective, and rank the produced tests according to their validity. Our evaluation of Libro shows that, on the widely studied Defects4J benchmark, Libro can generate failure reproducing test cases for 33% of all studied cases (251 out of 750), while suggesting a bug reproducing test in first place for 149 bugs. To mitigate data contamination (i.e., the possibility of the LLM simply remembering the test code either partially or in whole), we also evaluate Libro against 31 bug reports submitted after the collection of the LLM training data terminated: Libro produces bug reproducing tests for 32% of the studied bug reports. Overall, our results show Libro has the potential to significantly enhance developer efficiency by automatically generating tests from bug reports.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{abs-2209-11515,
  title = {Large Language Models are Few-shot Testers: Exploring LLM-based General Bug Reproduction},
  author = {Sungmin Kang and Juyeon Yoon and Shin Yoo},
  booktitle = {ICSE},
  year = {2023},
  doi = {10.1109/icse48619.2023.00194}
}