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

Otter:从 Issue 生成测试以验证 SWE 补丁

Otter: Generating Tests from Issues to Validate SWE Patches

IBM Research(IBM研究院)

Toufique Ahmed, Jatin Ganhotra, Rangeet Pan, Avraham Shinnar, Saurabh Sinha, Martin Hirzel

AI总结:

本文提出从 issue 生成测试以验证尚未存在的代码补丁,支持 TDD 与验证 SWE 智能体;构建了 TDD-Bench-Verified 基准,并提出结合规则分析与自反思规划器的 LLM 解决方案 Otter,在生成测试与补丁任务上均超越现有系统。

摘要:

尽管已有大量关于从现有代码生成测试的研究,但从 issue 生成测试的研究仍然有限。正确的测试必须验证解决该 issue 的代码补丁。本文重点关注该代码补丁尚不存在的场景。这样做支持两个主要用例。首先,它支持 TDD(测试驱动开发),这是一种“先写测试,后写代码”的规范,对人类软件工程师有充分记录的益处。其次,它还验证 SWE(软件工程)智能体,这些智能体生成代码补丁以解决 issue。本文介绍了 TDD-Bench-Verified,一个用于从 issue 生成测试的基准,以及 Otter,一个基于 LLM 的解决方案。Otter 通过基于规则的分析来增强 LLM,以检查和修复其输出,并引入了一种新颖的自反思动作规划器。实验表明,Otter 不仅在从 issue 生成测试方面超越了最先进的系统,还能增强从 issue 生成补丁的系统。我们希望 Otter 能帮助开发人员更高效地解决 issue,并带来更健壮、经过充分测试的代码。

英文摘要:

While there has been plenty of work on generating tests from existing code, there has been limited work on generating tests from issues. A correct test must validate the code patch that resolves the issue. This paper focuses on the scenario where that code patch does not yet exist. Doing so supports two major use-cases. First, it supports TDD (test-driven development), the discipline of "test first, write code later" that has well-documented benefits for human software engineers. Second, it also validates SWE (software engineering) agents, which generate code patches for resolving issues. This paper introduces TDD-Bench-Verified, a benchmark for generating tests from issues, and Otter, an LLM-based solution for this task. Otter augments LLMs with rule-based analysis to check and repair their outputs, and introduces a novel self-reflective action planner. Experiments show Otter outperforming state-of-the-art systems for generating tests from issues, in addition to enhancing systems that generate patches from issues. We hope that Otter helps make developers more productive at resolving issues and leads to more robust, well-tested code.

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

↑