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

TESTEVAL:面向测试用例生成的大型语言模型基准测试

TESTEVAL: Benchmarking Large Language Models for Test Case Generation

Wenhan Wang, Chenyuan Yang, Zhijie Wang, Yuheng Huang, Zhaoyang Chu, Da Song, Lingming Zhang, An Ran Chen, Lei Ma

AI总结:

本文提出TESTEVAL基准,通过210个Python程序和三项覆盖任务评估16个LLMs的测试用例生成能力,发现当前模型在覆盖特定程序逻辑和执行路径方面仍面临挑战。

摘要:

测试在软件开发周期中起着至关重要的作用,能够检测错误、漏洞和其他不良行为。为了执行软件测试,测试人员需要编写代码片段来运行被测程序。最近,研究人员认识到了大型语言模型(LLMs)在软件测试中的潜力。然而,在测试用例生成能力方面,不同LLMs之间仍然缺乏公平的比较。在本文中,我们提出了TESTEVAL,一个用于LLMs测试用例生成的新型基准。我们从在线编程平台LeetCode收集了210个Python程序,并设计了三个不同的任务:整体覆盖、目标行/分支覆盖和目标路径覆盖。我们进一步在TESTEVAL上评估了16个流行的LLMs,包括商业和开源模型。我们发现,生成测试用例以覆盖特定的程序行/分支/路径对于当前的LLMs仍然具有挑战性,这表明它们缺乏理解程序逻辑和执行路径的能力。我们已在https://github.com/LLM4SoftwareTesting/TestEval开源了我们的数据集和基准流水线。

英文摘要:

Testing plays a crucial role in the software development cycle, enabling the detection of bugs, vulnerabilities, and other undesirable behaviors. To perform software testing, testers need to write code snippets that execute the program under test. Recently, researchers have recognized the potential of large language models (LLMs) in software testing. However, there remains a lack of fair comparisons between different LLMs in terms of test case generation capabilities. In this paper, we propose TESTEVAL, a novel benchmark for test case generation with LLMs. We collect 210 Python programs from an online programming platform, LeetCode, and design three different tasks: overall coverage, targeted line/branch coverage, and targeted path coverage. We further evaluate sixteen popular LLMs, including both commercial and open-source ones, on TESTEVAL. We find that generating test cases to cover specific program lines/branches/paths is still challenging for current LLMs, indicating a lack of ability to comprehend program logic and execution paths. We have open-sourced our dataset and benchmark pipelines at https://github.com/LLM4SoftwareTesting/TestEval.

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

↑