paperbot · PL 论文追踪

全部论文 待读 收藏

P2 JUnitGenie: A Framework for Path-Sensitive Unit Test Generation with Large Language Models

JUnitGenie:基于大语言模型的路径敏感单元测试生成框架
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 4/10 · 论文将 LLM 用于 Java 单元测试生成,结合代码知识蒸馏与路径敏感提示,属于 LLM 辅助软件工程/程序分析相邻方向;但未涉及静态分析/形式化验证、浮点程序分析、贝叶斯程序分析或 Agentic 程序分析等核心问题,因此匹配度中等偏低。引用 0 inbox
Dianshu Liao, Xin Yin, Shidong Pan, Chao Ni, Zhenchang Xing, xiaoyu sun
crossref: 2026-09-12

AI 速览

一句话:从 Java 项目提取代码知识并蒸馏为结构化提示,引导 LLM 生成路径敏感的高覆盖率单元测试。

单元测试是软件质量保证的关键环节,但人工编写与维护成本高、易出错。已有的自动化测试生成方法,包括基于启发式规则的方法与近期基于大语言模型(LLM)的方法,本质上都是路径不敏感的:它们依赖固定启发式策略或有限的上下文信息,无法对深层控制流结构进行推理,因而在深层执行路径上覆盖率不足。针对这一问题,作者提出 JUnitGenie 框架,从 Java 项目中抽取代码知识(如控制流与控制依赖等),将其蒸馏为结构化提示,用以引导 LLM 生成高覆盖率的单元测试。评估在来自十个真实 Java 项目的 2258 个复杂焦点方法上进行,结果显示 JUnitGenie 相比启发式与 LLM 基线平均提升分支覆盖率 29.60%、行覆盖率 31.00%,并且在闭源与开源基础模型上均能有效泛化。

问题
现有启发式与 LLM 单元测试生成方法路径不敏感,缺乏对深层控制流结构的推理,导致深层执行路径覆盖不足。
方法
从 Java 项目中抽取代码知识并蒸馏为结构化提示,引导大语言模型进行路径敏感的单元测试生成。
评估
在十个真实 Java 项目的 2258 个复杂焦点方法上与启发式及 LLM 基线对比分支/行覆盖率,并在闭源与开源基础模型上验证泛化性。
原文摘要(Abstract)

Unit testing is essential for software quality assurance, yet writing and maintaining tests remains time-consuming and error-prone. To address this challenge, researchers have proposed techniques for automating unit test generation, including heuristic-based methods and more recent approaches that leverage large language models (LLMs). However, these approaches are inherently path-insensitive because they rely on fixed heuristics or limited contextual information and fail to reason about deep control-flow structures, which leads to inadequate coverage, especially for deep execution paths. JUnitGenie extracts code knowledge from Java projects, distills it into structured prompts, and guides LLMs to generate high-coverage tests. We evaluate JUnitGenie on 2,258 complex focal methods from ten real-world Java projects. Results show that JUnitGenie improves branch coverage by an average of 29.60% and line coverage by 31.00% over both heuristic and LLM-based baselines, and generalizes effectively across both closed- and open-source foundation models. JUnitGenie is available at https://github.com/Dianshu-Liao/JUnitGenie-ICSE-Demo , and the demo video is available at https://www.youtube.com/watch?v=-jWJaf661mw.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11534,
  title = {JUnitGenie: A Framework for Path-Sensitive Unit Test Generation with Large Language Models},
  author = {Dianshu Liao and Xin Yin and Shidong Pan and Chao Ni and Zhenchang Xing and xiaoyu sun},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3774748.3787600}
}