一句话:提出基于 LLM 的 Issue2Test,从 issue 报告自动生成按问题原因失败的可复现测试用例。
针对自动解决 GitHub issue 的关键步骤——生成能准确复现问题的测试用例——现有技术成功率有限。与面向通过测试的回归测试生成器不同,本文提出 Issue2Test,要求生成的测试失败,且失败原因与 issue 描述一致。该方法基于 LLM,分三步:理解 issue 并收集相关文件与项目指南等上下文;生成候选测试;根据编译和运行时反馈迭代精炼,直到测试失败且失败与 issue 问题对齐。在 SWT-bench-lite 上,Issue2Test 成功复现 32.9% 的 issue,相对最佳现有技术提升 16.3%;还复现了四个先前技术均失败的 20 个 issue,占这些工具复现 issue 总数的 60.4%。
Automated tools for solving GitHub issues are receiving significant attention by both researchers and practitioners, e.g., in the form of foundation models and LLM-based agents prompted with issues. A crucial step toward successfully solving an issue is creating a test case that accurately reproduces the issue. Such a test case can guide the search for an appropriate patch and help validate whether the patch matches the issue’s intent. However, existing techniques for issue reproduction show only moderate success. This paper presents Issue2Test , an LLM-based technique for automatically generating a reproducing test case for a given issue report. Unlike automated regression test generators, which aim at creating passing tests, our approach aims at a test that fails, and that fails specifically for the reason described in the issue. To this end, Issue2Test performs three steps: (1) understand the issue and gather context (e.g., related files and project-specific guidelines) relevant for reproducing it; (2) generate a candidate test case; and (3) iteratively refine the test case based on compilation and runtime feedback until it fails and the failure aligns with the problem described in the issue. We evaluate Issue2Test on the SWT-bench-lite dataset, where it successfully reproduces 32.9% of the issues, achieving a 16.3% relative improvement over the best existing technique. Our evaluation also shows that Issue2Test reproduces 20 issues that four prior techniques fail to address, contributing a total of 60.4% of all issues reproduced by these tools. We envision our approach to contribute to enhancing the overall progress in the important task of automatically solving GitHub issues.