跳到正文
arXiv:cs.AI· Guancheng Wang, Qinghua Xu, Lionel C. Briand, Zhaoqiang Guo, Kui Liu·· 10 小时前

CAT:面向 Java 项目的调用链感知 LLM 测试生成方法

Call-Chain-Aware LLM-Based Test Generation for Java Projects

AI 导读

研究者提出调用链感知的 LLM 测试生成方法 CAT,通过静态分析将调用链与依赖上下文显式纳入提示词,并支持生成失败时的迭代修复。在 Defects4J 基准上,CAT 的行覆盖率、分支覆盖率和变异得分分别比 PANTA 提升 12.52、12.97 和 14.39 个百分点,比 EvoSuite 提升 9.67、4.17 和 15.70 个百分点。

正文

View PDF HTML (experimental)

Abstract:Large language models (LLMs) have recently shown strong potential for generating project-level unit tests. However, existing state-of-the-art approaches primarily rely on execution-path information to guide prompt construction, which is often insufficient for complex software systems with rich inter-class dependencies, deep call chains, and intricate object initialization requirements. In this paper, we present CAT, a novel call-chain-aware LLM-based test generation approach that explicitly incorporates call-chain and dependency contexts into prompts through dedicated static analysis. To construct executable, semantically valid test contexts, CAT systematically models caller--callee relationships, object constructors, and third-party dependencies, and supports iterative test fixing when generation failures occur. We evaluate CAT on the widely used Defects4J benchmark and on four real-world GitHub projects released after the LLM's cut-off date, and compare it with the state-of-the-art LLM-based approach PANTA and the search-based tool EvoSuite. The results show that, across projects in Defects4J, CAT improves line coverage, branch coverage, and mutation score by 12.52, 12.97, and 14.39 percentage points (18.02%, 21.52%, and 26.94% relative), respectively, over PANTA, and by 9.67, 4.17, and 15.70 percentage points (13.37%, 6.04%, and 30.13% relative) over EvoSuite. On the post-cutoff projects, CAT also achieves the highest average line coverage, branch coverage, and mutation score among all compared approaches. An ablation study further demonstrates the importance of call-chain and dependency contexts in CAT.
Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI)
Cite as: arXiv:2604.22046 [cs.SE]
  (or arXiv:2604.22046v2 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2604.22046

arXiv-issued DOI via DataCite

Submission history

From: Guancheng Wang [view email]
[v1] Thu, 23 Apr 2026 20:03:18 UTC (231 KB)
[v2] Sun, 11 Oct 2026 00:10:08 UTC (247 KB)

来源:arXiv:cs.AI · arxiv.org