paperbot · PL 论文追踪

全部论文 待读 收藏

P2 DeepREST: Automated Test Case Generation for REST APIs Exploiting Deep Reinforcement Learning

DeepREST:利用深度强化学习自动生成 REST API 测试用例
ASE Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering2024匹配度 2/10 · 论文利用深度强化学习为REST API自动生成测试用例,属于软件测试与机器学习交叉,但用户研究方向核心是静态分析、形式化验证、浮点/贝叶斯程序分析及LLM/Agent在这些领域的应用,该论文不涉及静态分析或形式化验证,也未使用LLM/Agent,因此匹配度低。引用 35 inbox
Davide Corradini, Zeno Montolli, Michele Pasqua, Mariano Ceccato
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:用深度强化学习从黑盒交互中挖掘 REST API 的隐式约束,自动生成高覆盖、易检错的测试用例。

REST API 的自动化测试对构建可信的 Web 系统至关重要,但现有黑盒方法严重依赖 API 的形式化文档(Open API Specification)。OAS 主要刻画语法层面的信息,如操作间的生产者—消费者关系、输入值的属性以及自然语言描述的附加约束,却无法揭示 API 的业务逻辑语义,例如操作之间隐含的时序(逻辑依赖)关系与隐式的输入值约束,这使黑盒工具难以自动生成真正有效的测试用例。本文提出 DeepREST,一种面向 REST API 的黑盒自动测试方法,利用深度强化学习去发现文档中未显式给出的隐式 API 约束。方法以好奇心驱动的学习引导智能体探索 API,习得有效的操作测试顺序,从而先把 API 带入可测试状态并避免后续交互失败;同时把成功交互中积累的经验用于精确的输入数据生成,决定使用哪些参数以及如何取值;此外,DeepREST 在探索与利用之间交替,通过变异已成功的 API 交互来提升测试覆盖率并收集更多经验。实证验证表明,该方法在测试覆盖率与故障检测方面效果显著,并优于当前最先进的基线方法。

问题
现有 REST API 黑盒测试依赖 OAS 文档,只能获知语法层面的信息,缺失操作间隐式时序依赖与隐式输入约束等业务逻辑语义,因而难以自动生成真正有效的测试用例。
方法
提出 DeepREST:用深度强化学习训练智能体探索 API,以好奇心驱动学习发现隐式约束并习得操作测试顺序,用成功交互经验指导输入参数生成,并通过变异成功交互在探索与利用间交替。
评估
在真实 REST API 上进行实证验证,考察测试覆盖率与故障检测能力,并与当前最先进的基线方法对比,结果显示该方法显著更优。
原文摘要(Abstract)

Automatically crafting test scenarios for REST APIs helps deliver more reliable and trustworthy web-oriented systems. However, current black-box testing approaches rely heavily on the information available in the API’s formal documentation, i.e., the Open API Specification (OAS for short). While useful, the OAS mostly covers syntactic aspects of the API (e.g., producer-consumer relations between operations, input value properties, and additional constraints in natural language), and it lacks a deeper understanding of the API business logic. Missing semantics include implicit ordering (logic dependency) between operations and implicit input-value constraints. These limitations hinder the ability of black-box testing tools to generate truly effective test cases automatically.This paper introduces DeepREST, a novel black-box approach for automatically testing REST APIs. It leverages deep reinforcement learning to uncover implicit API constraints, that is, constraints hidden from API documentation. Curiosity-driven learning guides an agent in the exploration of the API and learns an effective order to test its operations. This helps identify which operations to test first to take the API in a testable state and avoid failing API interactions later. At the same time, experience gained on successful API interactions is leveraged to drive accurate input data generation (i.e., what parameters to use and how to pick their values). Additionally, DeepREST alternates exploration with exploitation by mutating successful API interactions to improve test coverage and collect further experience.Our empirical validation suggests that the proposed approach is very effective in achieving high test coverage and fault detection and superior to a state-of-the-art baseline.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{CorradiniMPC24,
  title = {DeepREST: Automated Test Case Generation for REST APIs Exploiting Deep Reinforcement Learning},
  author = {Davide Corradini and Zeno Montolli and Michele Pasqua and Mariano Ceccato},
  booktitle = {ASE},
  year = {2024},
  doi = {10.1145/3691620.3695511}
}