Unit testing is an essential yet laborious technique for verifying software and mitigating regression risks. Although classic automated methods effectively explore program structures, they often lack the semantic information required to produce realistic inputs and assertions. Large Language Models (LLMs) address this limitation by utilizing by leveraging their data-driven knowledge of code semantics and programming patterns. To analyze the state of the art in this domain, we conducted a systematic literature review of 115 publications published between May 2021 and August 2025. We propose a unified taxonomy based on the unit test generation lifecycle that treats LLMs as stochastic generators requiring systematic engineering constraints. This framework analyzes the literature regarding core generative strategies and a set of enhancement techniques ranging from pre-generation context enrichment to post-generation quality assurance. Our analysis reveals that prompt engineering has emerged as the dominant utilization strategy and accounts for 89% of the studies due to its flexibility. We find that iterative validation and repair loops have become the standard mechanism to ensure robust usability and lead to significant improvements in compilation and execution pass rates. However, critical challenges remain regarding the weak fault detection capabilities of generated tests and the lack of standardized evaluation benchmarks. We conclude with a roadmap for future research that emphasizes the progression towards autonomous testing agents and hybrid systems combining LLMs with traditional software engineering tools. This survey provides researchers and practitioners with a comprehensive perspective on converting the potential of LLMs into industrial-grade testing solutions.


翻译:单元测试是验证软件质量与降低回归风险的关键技术,但其执行过程通常较为繁琐。尽管经典的自动化方法能有效探索程序结构,却常因缺乏语义信息而难以生成符合实际的输入与断言。大语言模型通过利用其数据驱动的代码语义与编程模式知识,有效弥补了这一不足。为系统分析该领域的研究现状,我们对2021年5月至2025年8月期间发表的115篇文献进行了系统性综述,并提出基于单元测试生成生命周期的统一分类框架,将大语言模型视为需要系统性工程约束的随机生成器。该框架从核心生成策略及一系列增强技术(涵盖生成前上下文丰富化至生成后质量保障)的角度对文献进行了剖析。分析表明,提示工程因其灵活性已成为主导应用策略,占研究总量的89%。研究发现,迭代验证与修复循环已成为确保鲁棒可用性的标准机制,并显著提升了编译与执行通过率。然而,生成测试用例的缺陷检测能力较弱及缺乏标准化评估基准等关键挑战依然存在。最后,我们提出了未来研究的路线图,强调应朝着自主测试代理及融合大语言模型与传统软件工程工具的混合系统方向发展。本综述为研究者与实践者提供了将大语言模型潜力转化为工业级测试解决方案的全面视角。

0
下载
关闭预览

相关内容

专知会员服务
123+阅读 · 2020年12月9日
LibRec 每周算法:LDA主题模型
LibRec智能推荐
29+阅读 · 2017年12月4日
Spark机器学习:矩阵及推荐算法
LibRec智能推荐
16+阅读 · 2017年8月3日
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
VIP会员
相关资讯
LibRec 每周算法:LDA主题模型
LibRec智能推荐
29+阅读 · 2017年12月4日
Spark机器学习:矩阵及推荐算法
LibRec智能推荐
16+阅读 · 2017年8月3日
相关基金
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
Top
微信扫码咨询专知VIP会员