arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.02866cs.SEcs.AI
收藏

一种评估大语言模型测试用例生成能力的系统化方法

A Systematic Approach for Assessing Large Language Models' Test Case Generation Capability

R. B. Annis School of Engineering(R.B.安尼斯工程学院);E. S. Witchger School of Engineering(E.S.威彻格工程学院);University of Indianapolis(印第安纳波利斯大学);Marian University(玛丽安大学)

Hung-Fu Chang, Mohammad Shokrolah Shirazi

AI总结:

本文提出GBCV基准生成方法,通过控制流结构与变量使用组合系统化生成程序,评估GPT-4o和GPT-3-Turbo的测试用例生成能力,揭示了LLMs在复杂结构与算术计算上的优势与不足。

摘要:

软件测试保障软件产品的质量和可靠性,但手动创建测试用例劳动密集。随着大语言模型(LLMs)的兴起,人们对利用LLMs进行单元测试创建的兴趣日益增长。然而,由于缺乏全面覆盖多样化编程场景的标准化基准,对LLM生成测试用例的有效评估受到限制。为解决LLM测试用例生成能力的评估问题以及评估数据集的缺乏,我们提出了基于控制流结构与变量使用组合的生成基准(GBCV)方法,该方法系统化地生成用于评估LLMs测试生成能力的程序。通过利用基本控制流结构和变量使用,GBCV提供了一个灵活的框架,可创建从简单到复杂的程序谱系。由于GPT-4o和GPT-3-Turbo是公开可访问的模型,为呈现真实世界普通用户的使用场景,我们使用GBCV评估它们上的LLM性能。我们的研究结果表明,GPT-4o在复杂程序结构上表现更好,而所有模型都能有效检测简单条件中的边界值,但在算术计算方面面临挑战。本研究突出了LLMs在测试生成中的优势与局限,提供了一个基准框架,并为未来改进指明了方向。

英文摘要:

Software testing ensures the quality and reliability of software products, but manual test case creation is labor-intensive. With the rise of large language models (LLMs), there is growing interest in unit test creation with LLMs. However, effective assessment of LLM-generated test cases is limited by the lack of standardized benchmarks that comprehensively cover diverse programming scenarios. To address the assessment of LLM's test case generation ability and lacking dataset for evaluation, we propose the Generated Benchmark from Control-Flow Structure and Variable Usage Composition (GBCV) approach, which systematically generates programs used for evaluating LLMs' test generation capabilities. By leveraging basic control-flow structures and variable usage, GBCV provides a flexible framework to create a spectrum of programs ranging from simple to complex. Because GPT-4o and GPT-3-Turbo are publicly accessible models, to present real-world regular user's use case, we use GBCV to assess LLM performance on them. Our findings indicate that GPT-4o performs better on complex program structures, while all models effectively detect boundary values in simple conditions but face challenges with arithmetic computations. This study highlights the strengths and limitations of LLMs in test generation, provides a benchmark framework, and suggests directions for future improvement.

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

↑