Enhancing LLM's Ability to Generate More Repository-Aware Unit Tests Through Precise Contextual Information Injection
Not on the map. Why?
Abstract (arXiv)
Though many learning-based approaches have been proposed for unit test generation and achieved remarkable performance, they still have limitations in relying on task-specific datasets. Recently, Large Language Models (LLMs) guided by prompt engineering have gained attention for their ability to handle a broad range of tasks, including unit test generation. Despite their success, LLMs may exhibit hallucinations when generating unit tests for focal methods or functions due to their lack of awareness regarding the project's global context. These hallucinations may manifest as calls to non-existent methods, as well as incorrect parameters or return values, such as mismatched parameter types or numbers. While many studies have explored the role of context, they often extract fixed patterns of context for different models and focal methods, which may not be suitable for all generation processes (e.g., excessive irrelevant context could lead to redundancy, preventing the model from focusing on essential information). To overcome this limitation, we propose RATester, which enhances the LLM's ability to generate more repository-aware unit tests through global contextual information injection. To equip LLMs with global knowledge similar to that of human testers, we integrate the language server gopls, which provides essential features (e.g., definition lookup) to assist the LLM. When RATester encounters an unfamiliar identifier (e.g., an unfamiliar struct name), it first leverages gopls to fetch relevant definitions and documentation comments, and then uses this global knowledge to guide the LLM. By utilizing gopls, RATester enriches the LLM's knowledge of the project's global context, thereby reducing hallucinations during unit test generation.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). First posted on arXiv 13 Jan 2025.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 3; 2026: 1.
4 papers.
- 2025Large Language Models for Software Testing: A Research Roadmapcited by 2
- 2025A Survey on LLM-based News Recommender Systemscited by 1
- 2025Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language Modelscited by 1
- 2026ATTest: Agent-Driven Tensor Testing for Deep Learning Library Modulescited by 0
- 2026ATTest: Agent-Driven Tensor Testing for Deep Learning Library Modules15 Feb 2026
- 2025Large Language Models for Software Testing: A Research Roadmap29 Sep 2025
- 2025Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language Models28 Sep 2025
- 2025A Survey on LLM-based News Recommender Systems13 Feb 2025