paperbot · PL 论文追踪

全部论文 待读 收藏

P1 exLong: Generating Exceptional Behavior Tests with Large Language Models

exLong:使用大语言模型生成异常行为测试
ICSE 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)2025匹配度 5/10 · 该论文属于 LLM 用于程序语言/软件测试的交叉方向,通过异常路径推理生成异常行为测试,与用户关注的 AI→PL(用 LLM/Agent 改进程序分析)有相邻性;但它不涉及静态分析、形式化验证、浮点程序分析或贝叶斯程序分析,也不是 Agentic 程序分析或 PL→AI 方向。引用 4 inbox
Jiyang Zhang, Yu Liu, Pengyu Nie, Junyi Jessy Li, Milos Gligoric
crossref: 2026-09-12

AI 速览

一句话:首个自动生成异常行为测试的框架,通过指令微调 CodeLlama 并嵌入异常路径推理,超越现有模型与工具。

异常行为测试(EBT)用于验证代码能否检测异常并抛出恰当异常,但开发者大多只关注无异常事件的“happy path”,导致这类测试严重缺失。本文提出 ExLoNG——首个自动生成 EBT 的框架,它是对 CodeLlama 进行指令微调得到的大语言模型,并在生成过程中嵌入三类推理信息:通向 throw 语句的执行轨迹、守卫 throw 语句的条件表达式,以及执行相似轨迹的非异常行为测试。评估方面,作者将 ExLoNG 与当前最优的测试生成模型 CAT-LM、最强基础模型之一 GPT-4o,以及基于分析的测试生成工具 Randoop 和 EvoSuite 进行对比,结果显示 ExLoNG 均优于这些模型与工具。此外,作者向多个开源项目提交了 pull request,其中由 ExLoNG 生成的 23 个 EBT 已被合并接受,验证了其实际可用性。

问题
开发者普遍只编写无异常场景的 happy path 测试,异常行为测试(EBT)严重不足,而现有测试生成模型与工具难以自动生成高质量的 EBT。
方法
提出 ExLoNG,对 CodeLlama 进行指令微调,并显式嵌入通向 throw 语句的轨迹、守卫 throw 的条件表达式以及轨迹相似的非异常测试等推理信息来生成 EBT。
评估
与测试生成模型 CAT-LM、GPT-4o,以及基于分析的工具 Randoop 和 EvoSuite 对比,ExLoNG 全面胜出;并向开源项目提交 pull request,23 个生成的 EBT 被接受合并。
原文摘要(Abstract)

Many popular programming languages, including C#, Java, and Python, support exceptions. Exceptions are thrown during program execution if an unwanted event happens, e.g., a method is invoked with an illegal argument value. Software developers write exceptional behavior tests (EBTs) to check that their code detects unwanted events and throws appropriate exceptions. Prior research studies have shown the importance of EBTs, but those studies also highlighted that developers put most of their efforts on “happy paths”, e.g., paths without unwanted events. To help developers fill the gap, we present the first framework, dubbed ExLoNG, that automatically generates EBTs. ExLONG is a large language model instruction fine-tuned from CodeLlama and embeds reasoning about traces that lead to throw statements, conditional expressions that guard throw statements, and non-exceptional behavior tests that execute similar traces. We compare ExLONG with the state-of-the-art models for test generation (CAT-LM) and one of the strongest foundation models (GPT-4o), as well as with analysis-based tools for test generation (Randoop and EvoSuite). Our results show that ExLONG outperforms existing models and tools. Furthermore, we contributed several pull requests to open-source projects and 23 EBTs generated by ExLONG were already accepted.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8820,
  title = {exLong: Generating Exceptional Behavior Tests with Large Language Models},
  author = {Jiyang Zhang and Yu Liu and Pengyu Nie and Junyi Jessy Li and Milos Gligoric},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00176}
}