arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.09695cs.SE
收藏

基于新版本LLM的测试生成技术表现如何?

How well LLM-based test generation techniques perform with newer LLM versions?

SnT, University of Luxembourg(卢森堡大学 SnT);Luxuembourg Institute of Science and Technology(卢森堡科学与技术研究所)

Michael Konstantinou, Renzo Degiovanni, Mike Papadakis

AI总结:

本文研究了基于新版本LLM的测试生成技术表现,发现纯LLM方法在覆盖率和变异评分上优于现有方法,且成本相当。

摘要:

大语言模型(LLM)的快速演进已对软件工程产生了重大影响,导致关于自动化单元测试生成的研究日益增多。然而,单独使用LLM而不进行后处理已被证明效果不足,往往生成无法编译或覆盖率不高的测试。已提出几种技术来解决这些问题,报告了在测试编译和覆盖率方面的改进。尽管重要,基于LLM的测试生成技术在相对较弱的基线(按当今标准)上进行了评估,即旧版LLM和相对较弱的提示,这可能会加剧这些方法的性能贡献。换句话说,更强(更新的)LLM可能使这些方法的优势变得不必要。我们通过复制四个最先进的基于LLM的测试生成工具HITS、SymPrompt、TestSpark和CoverUp来研究这一问题,这些工具包含工程组件,旨在通过编译和执行反馈引导测试生成过程,并评估这些方法相对于纯LLM测试生成方法的相对有效性和效率。我们整合了当前的LLM版本到所有方法中,并在393个类和3657个方法上进行了实验。我们的结果表明,纯LLM方法在我们使用的所有测试有效性指标上均优于以前的最先进方法:行覆盖率(提高17.72%)、分支覆盖率(提高19.80%)和变异评分(提高20.92%),并且成本相当(LLM查询)。我们还观察到纯LLM应用的粒度对成本有显著影响。因此,我们建议首先针对程序类,因为测试生成更高效,然后针对未覆盖的方法以减少LLM请求的数量。这种策略在效果上相当(略高)的同时,仅需约20%的LLM请求。

英文摘要:

The rapid evolution of Large Language Models (LLMs) has strongly impacted software engineering, leading to a growing number of studies on automated unit test generation. However, the standalone use of LLMs without post-processing has proven insufficient, often producing tests that fail to compile or achieve high coverage. Several techniques have been proposed to address these issues, reporting improvements in test compilation and coverage. While important, LLM-based test generation techniques have been evaluated against relatively weak baselines (for todays' standards), i.e., old LLM versions and relatively weak prompts, which may exacerbate the performance contribution of the approaches. In other words, stronger (newer) LLMs may obviate any advantage these techniques bring. We investigate this issue by replicating four state-of-the-art LLM-based test generation tools, HITS, SymPrompt, TestSpark, and CoverUp that include engineering components aimed at guiding the test generation process through compilation and execution feedback, and evaluate their relative effectiveness and efficiency over a plain LLM test generation method. We integrate current LLM versions in all approaches and run an experiment on 393 classes and 3,657 methods. Our results show that the plain LLM approach can outperform previous state-of-the-art approaches in all test effectiveness metrics we used: line coverage (by 17.72%), branch coverage (by 19.80%) and mutation score (by 20.92%), and it does so at a comparable cost (LLM queries). We also observe that the granularity at which the plain LLM is applied has a significant impact on the cost. We therefore propose targeting first the program classes, where test generation is more efficient, and then the uncovered methods to reduce the number of LLM requests. This strategy achieves comparable (slightly higher) effectiveness while requiring about 20% fewer LLM requests.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑