Fixturize:弥合测试生成中的Fixture缺口
Fixturize: Bridging the Fixture Gap in Test Generation
AI总结:
Fixturize通过主动识别依赖fixture的函数并迭代生成fixture,提升自动化测试套件质量,显著提高测试通过率和覆盖率。
摘要:
当前大语言模型在自动化单元测试生成方面有所进展,但面临关键限制:往往忽视构建必要的测试fixture,即测试运行所需的环境设置。为弥合这一缺口,本文提出Fixturize,一个诊断框架,通过迭代反馈过程主动识别依赖fixture的函数并生成相应的fixture,从而提高现有方法生成的测试套件质量。为严格评估,作者引入FixtureEval,一个包含600个精心挑选的函数的基准,涵盖两种编程语言(Python和Java),并带有显式的fixture依赖标签,使相应的分类和生成任务成为可能。实证结果表明,Fixturize效果显著,在基准测试中识别fixture依赖的准确率为88.38%-97.00%,平均显著提高了测试套件通过率(SuitePS)18.03%-42.86%。由于维护测试fixture,Fixturize与现有测试工具结合后,进一步提高了代码行/分支覆盖率,分别平均提高了16.85%/24.08%和31.54%/119.66%。研究结果确立了fixture意识作为现代自动化测试流水线中不可或缺的组件。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。