arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.07277cs.SE
收藏

智能体化大语言模型:捕捉测试异味

Agentic LMs: Hunting Down Test Smells

Microsoft(微软)

Rian Melo, Pedro Simões, Rohit Gheyi, Marcelo d'Amorim, Márcio Ribeiro, Gustavo Soares, Eduardo Almeida, Elvys Soares

AI总结:

本研究评估小参数量智能体化大语言模型通过智能体工作流检测和重构测试异味的能力,在多语言场景下表现优异,Phi-4-14B重构准确率达75.3%,多智能体设置优于单智能体,部分生成代码被开源项目采纳。

摘要:

测试异味会降低测试套件的可靠性并增加维护复杂度。尽管已有多种测试异味检测方法,但支持自动化移除的极少,且多数依赖静态分析或机器学习。本研究评估参数规模相对较小的模型——Llama-3.2-3B、Gemma-2-9B、DeepSeek-R1-14B和Phi-4-14B——通过智能体工作流检测和重构测试异味的能力。我们在来自真实Java项目的5种常见异味的150个实例上,评估了包含1个、2个和4个智能体的工作流。该方法可推广至Python、Golang和JavaScript。所有模型几乎检测出所有实例,其中Phi-4-14B的重构准确率最高(pass@5为75.3%)。Phi-4-14B搭配4个智能体的表现与专有大语言模型(单智能体)相差不超过5%。在5种异味类型中,多智能体设置在3种类型上优于单智能体,不过对于断言轮盘,单智能体已足够。我们向开源项目提交了由Phi-4-14B生成代码的拉取请求,其中6个被合并。

英文摘要:

Test smells reduce test suite reliability and complicate maintenance. While many methods detect test smells, few support automated removal, and most rely on static analysis or machine learning. This study evaluates models with relatively small parameter counts - Llama-3.2-3B, Gemma-2-9B, DeepSeek-R1-14B, and Phi-4-14B - for their ability to detect and refactor test smells using agent-based workflows. We assess workflows with one, two, and four agents over 150 instances of 5 common smells from real-world Java projects. Our approach generalizes to Python, Golang, and JavaScript. All models detected nearly all instances, with Phi-4-14B achieving the best refactoring accuracy (pass@5 of 75.3%). Phi-4-14B with four-agents performed within 5% of proprietary LLMs (single-agent). Multi-agent setups outperformed single-agent ones in three of five smell types, though for Assertion Roulette, one agent sufficed. We submitted pull requests with Phi-4-14B-generated code to open-source projects and six were merged.

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

↑