Current Large Language Models (LLMs) have advanced automated unit test generation but face a critical limitation: they often neglect to construct the necessary test fixtures, which are the environmental setups required for a test to run. To bridge this gap, this paper proposes Fixturize, a diagnostic framework that proactively identifies fixture-dependent functions and synthesizes test fixtures accordingly through an iterative, feedback-driven process, thereby improving the quality of auto-generated test suites of existing approaches. For rigorous evaluation, the authors introduce FixtureEval, a dedicated benchmark comprising 600 curated functions across two Programming Languages (PLs), i.e., Python and Java, with explicit fixture dependency labels, enabling both the corresponding classification and generation tasks. Empirical results demonstrate that Fixturize is highly effective, achieving 88.38%-97.00% accuracy across benchmarks in identifying the dependence of test fixtures and significantly enhancing the Suite Pass rate (SuitePS) by 18.03%-42.86% on average across both PLs with the auto-generated fixtures. Owing to the maintenance of test fixtures, Fixturize further improves line/branch coverage when integrated with existing testing tools of both LLM-based and Search-based by 16.85%/24.08% and 31.54%/119.66% on average, respectively. The findings establish fixture awareness as an essential, missing component in modern auto-testing pipelines.


翻译:当前的大型语言模型(LLM)虽已推进了自动化单元测试生成的发展,但仍面临一个关键局限:它们常常忽略构建必要的测试固件,即测试运行所需的环境配置。为弥合这一差距,本文提出Fixturize,一种诊断框架,能主动识别依赖固件的函数,并通过迭代、反馈驱动的过程相应合成测试固件,从而提升现有方法自动生成测试套件的质量。为进行严谨评估,作者引入FixtureEval,一个专用基准数据集,包含跨两种编程语言(即Python和Java)的600个精选函数,并带有明确的固件依赖标签,以支持相应的分类与生成任务。实证结果表明,Fixturize高度有效,在识别测试固件依赖性的基准测试中达到88.38%-97.00%的准确率,并通过自动生成的固件将两种编程语言的套件通过率(SuitePS)平均显著提升18.03%-42.86%。得益于测试固件的维护,Fixturize在集成现有基于LLM和基于搜索的测试工具时,进一步将行/分支覆盖率平均分别提高了16.85%/24.08%和31.54%/119.66%。这些发现确立了固件感知作为现代自动化测试流程中一个必不可少却长期缺失的组成部分。

0
下载
关闭预览

相关内容

什么是后训练?大语言模型训练后优化方法综述,87页pdf
大型语言模型对齐技术综述:RLHF、RLAIF、PPO、DPO 等
专知会员服务
55+阅读 · 2024年7月24日
【ICML 2024】零阶优化器微调大模型,大幅降低内存
专知会员服务
32+阅读 · 2024年7月8日
探究检索增强下的大模型知识边界
专知会员服务
56+阅读 · 2023年7月25日
【干货】BERT模型的标准调优和花式调优
新智元
11+阅读 · 2019年4月26日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员