paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Tests

利用大语言模型增强自动生成单元测试的可理解性
ICSE 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)2025匹配度 3/10 · 论文将 LLM 用于提升自动生成单元测试的可理解性,属于软件测试与 LLM 辅助软件工程,与用户画像核心的静态分析、形式化验证、Agentic 程序以及浮点/贝叶斯程序分析交叉均无直接关联。引用 18 inbox
Amirhossein Deljouyi, Roham Koohestani, Maliheh Izadi, Andy Zaidman
crossref: 2026-09-12

AI 速览

一句话:提出 UTGen,用大语言模型改进自动生成单元测试的命名、测试数据与注释,从而提升可理解性。

自动单元测试生成器(如 EvoSuite 等基于搜索的测试工具)虽能生成高覆盖率测试,但生成结果往往难以被软件工程师理解。本文提出 UTGen,将基于搜索的软件测试与大语言模型结合,通过上下文化测试数据、改进标识符命名以及添加描述性注释来增强自动生成测试用例的可理解性。作者开展了一项有 32 名学术界与工业界参与者参加的对照实验,以缺陷修复任务模拟真实开发场景,考察单元测试可理解性对工程师修复缺陷能力的影响。结果显示,使用 UTGen 测试用例的参与者相比基线最多多修复 33% 的缺陷,并最多减少 20% 的耗时;后测问卷也表明,增强后的测试名称、测试数据和变量名改善了参与者的缺陷修复过程。

问题
自动生成的单元测试虽覆盖率较高,但可理解性差,增加软件工程师阅读、理解和基于测试进行缺陷修复的负担。
方法
UTGen 将基于搜索的软件测试与大语言模型结合,对自动生成的测试进行测试数据上下文化、标识符命名改进和描述性注释添加。
评估
通过 32 名学术界和工业界参与者参与的对照实验,比较 UTGen 测试用例与基线测试用例在缺陷修复任务中的修复数量与耗时,并结合后测问卷分析。
原文摘要(Abstract)

Automated unit test generators, particularly searchbased software testing tools like EvoSuite, are capable of generating tests with high coverage. Although these generators alleviate the burden of writing unit tests, they often pose challenges for software engineers in terms of understanding the generated tests. To address this, we introduce UTGen, which combines searchbased software testing and large language models to enhance the understandability of automatically generated test cases. We achieve this enhancement through contextualizing test data, improving identifier naming, and adding descriptive comments. Through a controlled experiment with 32 participants from both academia and industry, we investigate how the understandability of unit tests affects a software engineer's ability to perform bug-fixing tasks. We selected bug-fixing to simulate a real-world scenario that emphasizes the importance of understandable test cases. We observe that participants working on assignments with UTGen test cases fix up to 33 % more bugs and use up to 20 % less time when compared to baseline test cases. From the post-test questionnaire, we gathered that participants found that enhanced test names, test data, and variable names improved their bugfixing process.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8806,
  title = {Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Tests},
  author = {Amirhossein Deljouyi and Roham Koohestani and Maliheh Izadi and Andy Zaidman},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00032}
}