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

你命名它,我运行它:一个执行任意项目测试的LLM智能体

You Name It, I Run It: An LLM Agent to Execute Tests of Arbitrary Projects

University of Stuttgart(斯图加特大学)

Islem Bouzenia, Michael Pradel

AI总结:

本文提出基于LLM的自动化测试执行智能体ExecutionAgent,通过元提示和迭代反馈机制自主构建任意项目并运行测试套件,在50个开源项目中成功执行33个,偏差仅7.5%,较现有最佳技术提升6.6倍。

摘要:

执行项目的测试套件在许多场景中是必不可少的,例如评估代码质量和代码覆盖率,验证开发者或自动化工具所做的代码更改,以及确保与依赖项的兼容性。尽管其很重要,但在实践中执行项目的测试套件可能具有挑战性,因为不同的项目使用不同的编程语言、软件生态系统、构建系统、测试框架和其他工具。这些挑战使得创建一个适用于不同项目的可靠、通用的测试执行方法变得困难。本文提出了 ExecutionAgent,这是一种自动化技术,用于准备脚本以从源代码构建任意项目并运行其测试用例。受人类开发者处理此任务方式的启发,我们的方法是一个基于大型语言模型(LLM)的智能体,它自主执行命令并与主机系统交互。该智能体使用元提示来收集与给定项目相关的最新技术的指南,并根据先前步骤的反馈迭代地改进其过程。我们的评估将 ExecutionAgent 应用于 50 个开源项目,这些项目使用 14 种不同的编程语言和许多不同的构建与测试工具。该方法成功执行了 33/50 个项目的测试套件,同时与真实测试套件执行的测试结果相匹配,偏差仅为 7.5%。这些结果比之前可用的最佳技术提高了 6.6 倍。该方法所产生的成本是合理的,平均每个项目的执行时间为 74 分钟,LLM 成本为 0.16 美元。我们设想 ExecutionAgent 能够成为开发者、自动化编程工具和研究人员在广泛的各种项目中执行测试的宝贵工具。

英文摘要:

The ability to execute the test suite of a project is essential in many scenarios, e.g., to assess code quality and code coverage, to validate code changes made by developers or automated tools, and to ensure compatibility with dependencies. Despite its importance, executing the test suite of a project can be challenging in practice because different projects use different programming languages, software ecosystems, build systems, testing frameworks, and other tools. These challenges make it difficult to create a reliable, universal test execution method that works across different projects. This paper presents ExecutionAgent, an automated technique that prepares scripts for building an arbitrary project from source code and running its test cases. Inspired by the way a human developer would address this task, our approach is a large language model (LLM)-based agent that autonomously executes commands and interacts with the host system. The agent uses meta-prompting to gather guidelines on the latest technologies related to the given project, and it iteratively refines its process based on feedback from the previous steps. Our evaluation applies ExecutionAgent to 50 open-source projects that use 14 different programming languages and many different build and testing tools. The approach successfully executes the test suites of 33/50 projects, while matching the test results of ground truth test suite executions with a deviation of only 7.5%. These results improve over the best previously available technique by 6.6x. The costs imposed by the approach are reasonable, with an execution time of 74 minutes and LLM costs of USD 0.16, on average per project. We envision ExecutionAgent to serve as a valuable tool for developers, automated programming tools, and researchers that need to execute tests across a wide variety of projects.

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

↑