paperbot · PL 论文追踪

全部论文 待读 收藏

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

LSPRAG:LSP 引导的 RAG 用于语言无关的实时单元测试生成
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 5/10 · 论文把程序分析基础设施(LSP 的符号定义/引用解析)作为 LLM 的上下文来源,属于「静态分析式信息 + LLM」的交叉,与用户关注的 PL↔AI 方向有方法论上的重叠;但其目标任务是单元测试生成,而非静态分析/形式化验证本身,也未涉及浮点分析或贝叶斯程序分析,因此只是方向邻近而非核心。引用 2 inbox
Gwihwan Go, Quan Zhang, Chijin Zhou, Zhao Wei, Yu Jiang
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 LSPRAG,利用 LSP 实时检索精确上下文,实现语言无关的单元测试生成并提升覆盖率。

自动单元测试生成对软件质量保障很重要,但现有方法难以跨语言泛化并支持实时开发。LLM 可生成测试,却依赖焦点方法的简洁上下文;现有 RAG 要么使用不精确的相似度检索,要么需要昂贵的语言专用静态分析。本文提出 LspRag,一个面向实时、语言无关单元测试生成的简洁上下文检索框架。它复用现成 Language Server Protocol 后端,为 LLM 实时提供精确的符号定义与引用,从而实现语言感知的上下文检索,且每语言工程开销很小。作者在 Java、Go、Python 开源项目上评估。与最佳基线相比,LspRag 将行覆盖率最高提升 174.55%(Go)、213.31%(Java)和 31.57%(Python)。

问题
现有自动单元测试生成方法难以跨多种编程语言泛化,也难以在实时开发流程中运行;基于 LLM/RAG 的方案要么依赖不精确的相似度检索,要么需要昂贵的语言专用静态分析流水线。
方法
提出 LspRag,复用现成的 LSP 后端,通过 Language Server Protocol 实时获取符号定义与引用,为 LLM 提供语言感知且简洁的上下文检索,从而以极小的按语言工程开销生成单元测试。
评估
在 Java、Go、Python 开源项目上评估 LspRag,并与基线比较行覆盖率;相比最佳基线,Go、Java、Python 的行覆盖率最高分别提升 174.55%、213.31% 和 31.57%。
原文摘要(Abstract)

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.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2510-22210,
  title = {LSPRAG: LSP-Guided RAG for Language-Agnostic Real-Time Unit Test Generation},
  author = {Gwihwan Go and Quan Zhang and Chijin Zhou and Zhao Wei and Yu Jiang},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3773189}
}