arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.12952cs.SEcs.AIcs.LG
收藏

SWT-Bench:利用代码智能体测试与验证真实世界的缺陷修复

SWT-Bench: Testing and Validating Real-World Bug-Fixes with Code Agents

ETH Zurich(苏黎世联邦理工学院)

Niels Mündler, Mark Niklas Müller, Jingxuan He, Martin Vechev

AI总结:

本文提出SWT-Bench基准,利用基于LLM的代码智能体将真实GitHub问题转化为测试用例,并证明生成的测试能有效过滤代码修复,使SWE-Agent精确率翻倍。

摘要:

严格的软件测试对于开发和维护高质量代码至关重要,这使得自动化测试生成成为提高软件质量和增强代码生成方法有效性的一个有前景的方向。然而,尽管基于大语言模型(LLMs)的代码生成是一个非常活跃的研究领域,测试生成仍然相对未被探索。我们针对这一空白展开研究,考察基于LLM的代码智能体将用户问题形式化为测试用例的能力。为此,我们提出了一个基于热门GitHub仓库的新基准,其中包含真实世界的问题、真实的缺陷修复和黄金测试。我们发现,LLM在生成相关测试用例方面总体上表现得出奇地好,其中为代码修复设计的代码智能体超过了专门为测试生成设计的系统的性能。此外,由于测试生成与代码生成类似但更具结构性,它允许利用问题复现率和覆盖率变化进行更细粒度的分析,从而为分析用于代码修复的系统提供了双重指标。最后,我们发现生成的测试是所提出代码修复的有效过滤器,使SWE-Agent的精确率提高了一倍。我们在https://github.com/logic-star-ai/SWT-Bench发布所有数据和代码。

英文摘要:

Rigorous software testing is crucial for developing and maintaining high-quality code, making automated test generation a promising avenue for both improving software quality and boosting the effectiveness of code generation methods. However, while code generation with Large Language Models (LLMs) is an extraordinarily active research area, test generation remains relatively unexplored. We address this gap and investigate the capability of LLM-based Code Agents to formalize user issues into test cases. To this end, we propose a novel benchmark based on popular GitHub repositories, containing real-world issues, ground-truth bug-fixes, and golden tests. We find that LLMs generally perform surprisingly well at generating relevant test cases, with Code Agents designed for code repair exceeding the performance of systems designed specifically for test generation. Further, as test generation is a similar but more structured task than code generation, it allows for a more fine-grained analysis using issue reproduction rate and coverage changes, providing a dual metric for analyzing systems designed for code repair. Finally, we find that generated tests are an effective filter for proposed code fixes, doubling the precision of SWE-Agent. We release all data and code at https://github.com/logic-star-ai/SWT-Bench

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

↑