Files
logseq/pages/@Multi-Agent LLM Collaboration for Enhancing Unit Test Generation Using Repository-Aware Knowledge Graphs.md

2.7 KiB
Raw Permalink Blame History

tags:: #zotero date:: 2018 title:: @Multi-Agent LLM Collaboration for Enhancing Unit Test Generation Using Repository-Aware Knowledge Graphs item-type:: journalArticle original-title:: Multi-Agent LLM Collaboration for Enhancing Unit Test Generation Using Repository-Aware Knowledge Graphs language:: en library-catalog:: Zotero links:: Local library, Web library

  • Abstract
    • Recently, the emergence of Large Language Models (LLMs) has spurred a surge of research into automated unit test generation, demonstrating impressive performance and reducing manual effort. However, existing LLM-based approaches still suffer from two major limitations: (1) they rely on rule-based context extraction, which fails to capture fine-grained code dependencies, limiting LLMs ability to understand program semantics and derive test requirements; (2) they follow rigid, procedural workflows that underutilize the autonomous reasoning potential of LLMs, making it difficult to dynamically adapt testing strategies based on real-time feedback. In this paper, we propose TestAgent, an LLM-based test generation approach that addresses the above limitations by emulating the human testing practice via a multi-agent collaboration mechanism. Particularly, TestAgent designs three specialized agents, i.e., requirement planner, test generator, and test reviewer, to simulate how developers understand, construct, and validate unit tests. Moreover, to unleash the autonomous capabilities of LLMs, we equip TestAgent with a set of tool APIs that can be invoked dynamically by LLMs in an on-demand and adaptive manner. Furthermore, to support repository-level context retrieval and reasoning, TestAgent integrates a repository-aware knowledge graph that provides a structured representation of large-scale codebases and captures fine-grained dependency relations through graph edges. Experimental results show that TestAgent achieves 97.46% execution rate, 92.34% line coverage, 90.24% branch coverage, and 83.69% mutation score on six Java projects, significantly outperforming search-based and LLM-based baselines. We also adapt TestAgent Python projects with 88.85% line coverage and 78.89% branch coverage, demonstrating its generalizability beyond the Java ecosystem. Moreover, the results on three industrial projects and a controlled user study demonstrate the practical applicability and usability of TestAgent in real-world development scenarios.
  • Attachments

    • PDF {{zotero-imported-file L3AMMAVS, "2018 - Multi-Agent LLM Collaboration for Enhancing Unit Test Generation Using Repository-Aware Knowledge Gr.pdf"}}