测试之战:SBST、符号执行与基于LLM的单元测试生成方法的对比研究
Test Wars: A Comparative Study of SBST, Symbolic Execution, and LLM-Based Approaches to Unit Test Generation
AI总结:
本研究对比了SBST工具EvoSuite、符号执行工具Kex与LLM测试生成工具TestSpark在GitBug Java数据集上的表现,发现LLM方法变异得分更优但覆盖率、故障检测能力弱于传统方法,且对被测类规模更敏感。
摘要:
自动生成测试是软件工程研究中一个关键且持续受到关注的领域。大语言模型(LLM)凭借其执行广泛任务的能力,为该领域带来了新的机遇。然而,与基于搜索的软件测试(SBST)、符号执行等传统技术相比,基于LLM的方法的有效性仍不明确。本文针对三种自动测试生成工具开展了广泛研究:对应SBST的EvoSuite、对应符号执行的Kex,以及对应基于LLM的测试生成的TestSpark。我们在GitBug Java数据集上评估这些工具的性能,并使用多种基于执行和基于特征的指标对其进行比较。结果表明,尽管基于LLM的测试生成颇具前景,但在覆盖率方面落后于传统方法。不过,它在变异得分上显著优于传统方法,说明LLM对代码具备更深的语义理解能力。在故障检测能力方面,基于LLM的方法表现也差于SBST和基于符号执行的方法。此外,我们的基于特征的分析显示,所有工具主要受被测类(CUT)的复杂度和内部依赖影响,其中基于LLM的方法对被测类的规模尤为敏感。
英文摘要:
Generating tests automatically is a key and ongoing area of focus in software engineering research. The emergence of Large Language Models (LLMs) has opened up new opportunities, given their ability to perform a wide spectrum of tasks. However, the effectiveness of LLM-based approaches compared to traditional techniques such as search-based software testing (SBST) and symbolic execution remains uncertain. In this paper, we perform an extensive study of automatic test generation approaches based on three tools: EvoSuite for SBST, Kex for symbolic execution, and TestSpark for LLM-based test generation. We evaluate tools performance on the GitBug Java dataset and compare them using various execution-based and feature-based metrics. Our results show that while LLM-based test generation is promising, it falls behind traditional methods in terms of coverage. However, it significantly outperforms them in mutation scores, suggesting that LLMs provide a deeper semantic understanding of code. LLM-based approach also performed worse than SBST and symbolic execution-based approaches w.r.t. fault detection capabilities. Additionally, our feature-based analysis shows that all tools are primarily affected by the complexity and internal dependencies of the class under test (CUT), with LLM-based approaches being especially sensitive to the CUT size.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。