arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2503.16320cs.SE
收藏

Issue2Test: 从问题报告中生成可重复测试用例

Issue2Test: Generating Reproducing Test Cases from Issue Reports

University of British Columbia(不列颠哥伦比亚大学);CISPA Helmholtz Center for Information Security(CISPA赫尔霍特信息安全中心)

Noor Nashid, Islem Bouzenia, Michael Pradel, Ali Mesbah

AI总结:

Issue2Test通过生成失败测试用例来自动复现GitHub问题,提升了问题解决效率。

摘要:

针对GitHub问题解决的自动化工具正受到研究人员和实践者广泛关注,例如以基础模型和基于LLM的代理形式出现。成功解决一个问题的关键步骤之一是创建一个能准确复现问题的测试用例。此类测试用例可以指导寻找合适的补丁,并帮助验证补丁是否符合问题的意图。然而,现有问题复现技术的效果仅中等。本文提出了Issue2Test,一种基于LLM的自动技术,用于为给定的问题报告生成可复现的测试用例。与旨在创建通过测试的自动回归测试生成器不同,我们的方法旨在生成一个失败的测试用例,并且该失败具体对应问题中描述的原因。为此,Issue2Test执行三个步骤:(1) 理解问题并收集与复现相关的内容(例如相关文件和项目特定指南);(2) 生成候选测试用例;(3) 根据编译和运行时反馈迭代优化测试用例,直到其失败且失败与问题描述中的问题一致。我们在SWT-bench-lite数据集上评估Issue2Test,其中成功复现了32.9%的问题,比现有最佳技术提高了16.3%。我们的评估还显示,Issue2Test复现了20个四个先前技术无法处理的问题,这些工具总共复现了60.4%的问题。我们设想我们的方法将有助于增强在自动解决GitHub问题任务中的整体进展。

英文摘要:

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.

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

↑