Benchmarking LLM Agents for Behaviorally Adequate Test Generation from Software Requirements
作者: Binhang Qi, Yiming Liu, Yun Lin, Yangjie Zhou, Hailong Sun, Jin Song Dong
分类: cs.SE, cs.AI
发布日期: 2026-10-27
💡 一句话要点
提出Req2Test-Bench以解决软件需求测试生成的行为适应性问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 需求验证 测试生成 行为驱动开发 大型语言模型 软件工程 自动化测试
📋 核心要点
- 现有的测试生成方法主要集中在白盒测试,缺乏对需求与生成测试之间语义一致性的评估。
- 本文提出Req2Test-Bench基准,通过5086个实例评估代理生成的测试的行为适应性,提供了新的评估标准。
- 实验结果表明,最佳配置的通过率为82.8%,但仅有33.8%的测试在行为上是适应的,揭示了现有方法的局限性。
📝 摘要(中文)
随着大型语言模型代理越来越多地将自然语言需求编译为代码,需求到测试的生成变得愈发重要,以提供验证约束来指导代码生成。然而,目前尚不清楚现有代理是否能够生成验证所需行为的测试。现有的测试生成基准主要集中在白盒测试上,而需求与测试相关的研究通常需要评估给定文档与生成测试之间的语义一致性。本文引入了Req2Test-Bench基准,包含5086个从开发者编写的行为驱动开发(BDD)文档中恢复的执行验证实例,涵盖8个开源项目、5种编程语言和4种BDD框架。每个实例将自然语言需求与开发者编写的测试实现配对。评估8种代理-模型-推理配置显示,执行成功与行为适应性之间存在显著差距。
🔬 方法详解
问题定义:本文旨在解决现有测试生成方法在验证软件需求行为适应性方面的不足,尤其是在需求不明确的情况下,生成的测试可能无法有效验证实现的行为。
核心思路:提出Req2Test-Bench基准,通过对开发者编写的BDD文档进行分析,评估代理生成的测试的行为适应性,以此来指导测试生成的改进。
技术框架:整体架构包括需求解析、测试生成和执行验证三个主要模块。首先解析自然语言需求,然后生成测试实现,最后通过执行验证测试的有效性。
关键创新:引入了kill-completeness作为行为适应性的评估标准,强调生成测试不仅要通过,还需在行为上与真实需求一致,这是与现有方法的本质区别。
关键设计:在实验中,采用了多种代理-模型-推理配置,特别是Codex与DeepSeek-V4.1-Flash的组合,显示出在生成测试时的高效性和有效性。
🖼️ 关键图片
📊 实验亮点
实验结果显示,最佳配置的测试通过率为82.8%,但行为适应性仅为33.8%,揭示了现有方法在生成有效测试方面的局限性。这一发现为未来的研究提供了重要的改进方向。
🎯 应用场景
该研究的潜在应用领域包括软件开发中的自动化测试生成、需求验证和质量保证。通过提高测试生成的行为适应性,可以显著提升软件的可靠性和安全性,未来可能对软件工程实践产生深远影响。
📄 摘要(原文)
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.