arXiv:2604.25862cs.SEcs.AI2026-04中稿 · EASE 2026被引 1

为评估大模型生成的API测试用例有效性,提出新基准与检测指标。

RESTestBench: A Benchmark for Evaluating the Effectiveness of LLM-Generated REST API Test Cases from NL Requirements

论文配图:RESTestBench: A Benchmark for Evaluating the Effectiveness of LLM-Generated REST API Test Cases from NL Requirements
图 1 · 摘自论文原文
  • 构建含精确/模糊需求的三套REST服务,支持可控评估
  • 引入基于需求的变异测试指标,量化测试对缺陷的发现能力
  • 发现模糊需求下迭代生成反降低效果,高精度需求无需实际系统反馈

现有REST API测试工具多依赖代码覆盖率和崩溃故障指标进行评估。但近年来基于大模型的测试生成方法从自然语言需求出发验证功能行为,传统指标难以反映生成测试是否真正验证了预期行为。为此,我们提出RESTestBench基准,包含三套REST服务及对应的手动验证的自然语言需求(精确与模糊版本),支持可控且可复现的需求驱动测试生成评估。该基准进一步引入基于需求的变异测试指标,衡量生成测试用例针对特定需求的缺陷检测能力,扩展了Bartocci等人提出的属性驱动方法。利用RESTestBench,我们在多个主流大模型上评估两种方法:(i) 无精炼的直接生成;(ii) 通过与运行中的系统(SUT)交互进行精炼。在精炼实验中,评估暴露于真实实现或变异代码对测试效果的影响。结果表明,当生成器接触有缺陷或被变异的代码时,测试效果显著下降,尤其在模糊需求场景下,有时甚至抵消精炼带来的收益,提示在需求细节充分时,引入实际系统行为并无必要。

原文摘要 · Abstract (English)

Existing REST API testing tools are typically evaluated using code coverage and crash-based fault metrics. However, recent LLM-based approaches increasingly generate tests from NL requirements to validate functional behaviour, making traditional metrics weak proxies for whether generated tests validate intended behaviour. To address this gap, we present RESTestBench, a benchmark comprising three REST services paired with manually verified NL requirements in both precise and vague variants, enabling controlled and reproducible evaluation of requirement-based test generation. RESTestBench further introduces a requirements-based mutation testing metric that measures the fault-detection effectiveness of a generated test case with respect to a specific requirement, extending the property-based approach of Bartocci et al. . Using RESTestBench, we evaluate two approaches across multiple state-of-the-art LLMs: (i) non-refinement-based generation, and (ii) refinement-based generation guided by interaction with the running SUT. In the refinement experiments, RESTestBench assesses how exposure to the actual implementation, valid or mutated, affects test effectiveness. Our results show that test effectiveness drops considerably when the generator interacts with faulty or mutated code, especially for vague requirements, sometimes negating the benefit of refinement and indicating that incorporating actual SUT behaviour is unnecessary when requirement detail is high.

API测试大模型生成基准测试需求驱动

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。