paperbot · PL 论文追踪

全部论文 待读 收藏

P2 TestAgent: A Multi-Agent LLM Framework for Repository-Level Unit Test Generation

TestAgent:面向仓库级单元测试生成的多智能体 LLM 框架
FSE Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering2026匹配度 4/10 · 论文属于 LLM 多智能体在仓库级单元测试生成中的应用,与用户关注的 Agentic 程序、LLM 辅助软件工程有边缘交集,但其核心任务是测试生成而非静态分析、浮点程序分析或贝叶斯程序分析,也不是用静态分析改进 Agentic 程序。引用 0 inbox
Ye Shang, Quanjun Zhang, Zhengyu Zhan, Ke Huang, Chunrong Fang, Zhenyu Chen
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出基于仓库级代码知识图谱的多智能体 LLM 工具,自动生成高质量 Java 单元测试并发现真实缺陷。

针对现有基于 LLM 的单元测试生成工具仓库级上下文有限、生成流程僵化的问题,本文提出 TestAgent——一个以 VS Code 扩展形式实现的多智能体工具,用于为 Java 项目自动生成高质量单元测试。该方法构建仓库级代码知识图谱以提供上下文,并模仿人类开发者的结构化实践,协调三个专门智能体:Planner 推导测试需求,Generator 借助工具辅助检索合成可执行测试代码,Reviewer 依据执行反馈迭代精化测试。在六个 Java 项目的 1,451 个方法上进行评估,TestAgent 达到 92.34% 的行覆盖率,显著优于 EvoSuite、ChatUniTest 等基线;同时以 92.22% 的高精确率成功检测出 154 个真实缺陷,表明其在回归测试与缺陷发现中的实用价值。

问题
现有基于 LLM 的单元测试生成工具受限于仓库级上下文不足与刚性生成工作流,难以产出高质量、可执行的测试。
方法
实现为 VS Code 扩展的多智能体框架,利用仓库级代码知识图谱,由 Planner 推导测试需求、Generator 工具辅助检索并合成测试、Reviewer 基于执行反馈迭代精化。
评估
在六个 Java 项目的 1,451 个方法上评估行覆盖率,并与 EvoSuite、ChatUniTest 等基线对比,同时统计真实缺陷检测数量与精确率。
原文摘要(Abstract)

Automated unit test generation plays a critical role in maintaining software quality, yet existing LLM-based tools often struggle with limited repository-level context and rigid generation workflows. In this paper, we present TestAgent, a multi-agent tool implemented as a VS Code extension that automates the generation of high-quality unit tests for Java projects using repository-level Code Knowledge Graphs. Unlike existing tools that rely on coarse-grained workflows, TestAgent mirrors the structured practices of human developers, who typically analyze requirements before writing tests and review results afterward, by coordinating three specialized agents: a Planner to derive testing requirements, a Generator to synthesize executable code via tool-assisted retrieval, and a Reviewer to iteratively refine tests based on execution feedback. Evaluation on 1,451 methods across six Java projects demonstrates that TestAgent achieves a 92.34% line coverage, significantly outperforming baselines like EvoSuite and ChatUniTest. Furthermore, the tool successfully detects 154 real-world bugs with high precision (92.22%), demonstrating its practical utility for regression testing and bug discovery. The tool source code and demonstration are available at: https://github.com/iSEngLab/TestAgent-VSCode-Extension.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@inproceedings{ShangZZHFC26,
  title = {TestAgent: A Multi-Agent LLM Framework for Repository-Level Unit Test Generation},
  author = {Ye Shang and Quanjun Zhang and Zhengyu Zhan and Ke Huang and Chunrong Fang and Zhenyu Chen},
  booktitle = {FSE},
  year = {2026},
  doi = {10.1145/3803437.3806428}
}