LSPRAG: LSP-Guided RAG for Language-Agnostic Real-Time Unit Test Generation

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Go, Gwihwan, Zhang, Quan, Zhou, Chijin, Wei, Zhao, Jiang, Yu
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866911477657501696
author Go, Gwihwan
Zhang, Quan
Zhou, Chijin
Wei, Zhao
Jiang, Yu
author_facet Go, Gwihwan
Zhang, Quan
Zhou, Chijin
Wei, Zhao
Jiang, Yu
contents Automated unit test generation is essential for robust software development, yet existing approaches struggle to generalize across multiple programming languages and operate within real-time development. While Large Language Models (LLMs) offer a promising solution, their ability to generate high coverage test code depends on prompting a concise context of the focal method. Current solutions, such as Retrieval-Augmented Generation, either rely on imprecise similarity-based searches or demand the creation of costly, language-specific static analysis pipelines. To address this gap, we present LSPRAG, a framework for concise-context retrieval tailored for real-time, language-agnostic unit test generation. LSPRAG leverages off-the-shelf Language Server Protocol (LSP) back-ends to supply LLMs with precise symbol definitions and references in real time. By reusing mature LSP servers, LSPRAG provides an LLM with language-aware context retrieval, requiring minimal per-language engineering effort. We evaluated LSPRAG on open-source projects spanning Java, Go, and Python. Compared to the best performance of baselines, LSPRAG increased line coverage by up to 174.55% for Golang, 213.31% for Java, and 31.57% for Python.
format Preprint
id arxiv_https___arxiv_org_abs_2510_22210
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle LSPRAG: LSP-Guided RAG for Language-Agnostic Real-Time Unit Test Generation
Go, Gwihwan
Zhang, Quan
Zhou, Chijin
Wei, Zhao
Jiang, Yu
Software Engineering
Artificial Intelligence
D.2.5
Automated unit test generation is essential for robust software development, yet existing approaches struggle to generalize across multiple programming languages and operate within real-time development. While Large Language Models (LLMs) offer a promising solution, their ability to generate high coverage test code depends on prompting a concise context of the focal method. Current solutions, such as Retrieval-Augmented Generation, either rely on imprecise similarity-based searches or demand the creation of costly, language-specific static analysis pipelines. To address this gap, we present LSPRAG, a framework for concise-context retrieval tailored for real-time, language-agnostic unit test generation. LSPRAG leverages off-the-shelf Language Server Protocol (LSP) back-ends to supply LLMs with precise symbol definitions and references in real time. By reusing mature LSP servers, LSPRAG provides an LLM with language-aware context retrieval, requiring minimal per-language engineering effort. We evaluated LSPRAG on open-source projects spanning Java, Go, and Python. Compared to the best performance of baselines, LSPRAG increased line coverage by up to 174.55% for Golang, 213.31% for Java, and 31.57% for Python.
title LSPRAG: LSP-Guided RAG for Language-Agnostic Real-Time Unit Test Generation
topic Software Engineering
Artificial Intelligence
D.2.5
url https://arxiv.org/abs/2510.22210