对用于从软件需求生成行为充分测试的大语言模型智能体进行基准测试
Benchmarking LLM Agents for Behaviorally Adequate Test Generation from Software Requirements
AI总结:
该研究提出Req2Test-Bench基准,评估8种智能体配置发现其执行成功率与行为充分性差距大,Codex结合DeepSeek-V4.1-Flash表现最佳但行为充分性仅33.8%,并指出改进方向。
摘要:
随着大语言模型智能体越来越多地将自然语言需求编译为仓库级代码,需求到测试的生成对于提供验证约束(或测试框架)以指导代码生成变得愈发重要。然而,当行为的实现被隐藏时,当前智能体能否生成验证该行为的测试仍不清楚。现有的测试生成基准大多聚焦于白盒测试,而与需求-测试相关的研究通常需要评估给定文档与生成测试之间的语义对齐。我们提出Req2Test-Bench,这是一个包含5086个经执行验证的实例的基准,这些实例从8个开源项目中开发者编写的行为驱动开发(BDD)制品中提取,涵盖5种编程语言和4种BDD框架。每个实例将Gherkin格式的自然语言需求与其开发者编写的测试实现配对。给定需求、所需行为的目标接口,智能体必须生成完整的、可能是多文件的测试实现。对8种智能体-模型-推理配置的评估显示,执行成功率与行为充分性之间存在巨大差距,行为充分性被严格定义为突变体杀伤完整性:一个杀伤完整的测试能够杀死所有真实测试会杀死的突变体。表现最佳的配置是Codex结合DeepSeek-V4.1-Flash,它能为82.8%的实例生成通过的测试,但其中仅33.8%具有行为充分性。我们发现:(1)扩大智能体规模会导致行为充分性相对于生成成本的回报急剧递减;(2)需求规格不足会导致信息缺口,包括模糊的设置和隐含的预期结果;(3)基于需求的测试框架可引导智能体的非确定性,这是一个有前景的改进方向。
英文摘要:
As large language model agents increasingly compile natural-language requirements into repository-level code, requirement-to-test generation grows in importance to provide validation constraints (or harness) to guide code generation. Yet it remains unclear whether current agents can generate tests that validate the required behavior when the implementation of that behavior is withheld. Existing test-generation benchmarks mostly focus on white-box testing, whereas the requirement--test-related study usually requires evaluation on semantic alignment between the given documents and the generated tests. We introduce Req2Test-Bench, a benchmark containing 5,086 execution-validated instances recovered from developer-authored behavior-driven development (BDD) artifacts in 8 open-source projects, spanning 5 programming languages and 4 BDD frameworks. Each instance pairs a natural-language requirement in Gherkin with its developer-written Test Implementation. Given the requirement, target interfaces of the required behavior, an agent must generate a complete, potentially multi-file Test Implementation. Evaluation of 8 agent--model--reasoning configurations reveals a substantial gap between execution success and behavioral adequacy, which is measured strictly as kill-completeness: a kill-complete test kills every mutant that the ground-truth test kills. The best-performing configuration, Codex with DeepSeek-V4.1-Flash, produces passing tests for 82.8% of instances, yet only 33.8% are behaviorally adequate. We find that (1) scaling up agents yields sharply diminishing returns in behavioral adequacy relative to generation cost; (2) under-specified requirements cause the information gap, including ambiguous setup and implicit expected outcomes; and (3) requirement-grounded harnesses that steer agent non-determinism offer a promising direction for improvement.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。