用多智能体和大模型提升REST API测试覆盖率与错误发现能力
A Multi-Agent Approach for REST API Testing with Semantic Graphs and LLM-Driven Inputs
- 四类智能体协作探索接口,结合语义依赖图与大模型生成真实测试数据
- 在12个真实服务上测试,覆盖度和错误检测率均优于现有工具,能触发Spotify内部错误
- 适用于需要高可靠性测试的API开发与安全团队
随着现代网络服务日益依赖REST API,其全面测试变得至关重要。开放API规范(OpenAPI)的出现催生了众多黑盒测试工具,但这些工具常孤立处理接口、参数或值,导致覆盖率低且故障检测效果不佳。为此,我们提出AutoRestTest,首个采用依赖嵌入式多智能体架构的黑盒测试工具,融合多智能体强化学习(MARL)、语义属性依赖图(SPDG)与大语言模型(LLM)。该方法将测试任务拆解为四个协作智能体:接口、依赖、参数和值智能体。LLM负责生成领域特定值,SPDG通过操作间相似度评分压缩依赖搜索空间,MARL动态优化智能体行为。在12个真实世界服务上的评估表明,AutoRestTest在代码覆盖率、操作覆盖率及故障检测方面均超越四种主流黑盒测试工具,包括基于RESTGPT的工具。尤为关键的是,它是唯一能在Spotify服务中触发内部服务器错误的工具。消融实验显示,SPDG、LLM与智能体学习机制均对整体性能有贡献。
原文摘要 · Abstract (English)
As modern web services increasingly rely on REST APIs, their thorough testing has become crucial. Furthermore, the advent of REST API documentation languages, such as the OpenAPI Specification, has led to the emergence of many black-box REST API testing tools. However, these tools often focus on individual test elements in isolation (e.g., APIs, parameters, values), resulting in lower coverage and less effectiveness in fault detection. To address these limitations, we present AutoRestTest, the first black-box tool to adopt a dependency-embedded multi-agent approach for REST API testing that integrates multi-agent reinforcement learning (MARL) with a semantic property dependency graph (SPDG) and Large Language Models (LLMs). Our approach treats REST API testing as a separable problem, where four agents -- API, dependency, parameter, and value agents -- collaborate to optimize API exploration. LLMs handle domain-specific value generation, the SPDG model simplifies the search space for dependencies using a similarity score between API operations, and MARL dynamically optimizes the agents' behavior. Our evaluation of AutoRestTest on 12 real-world REST services shows that it outperforms the four leading black-box REST API testing tools, including those assisted by RESTGPT (which generates realistic test inputs using LLMs), in terms of code coverage, operation coverage, and fault detection. Notably, AutoRestTest is the only tool able to trigger an internal server error in the Spotify service. Our ablation study illustrates that each component of AutoRestTest -- the SPDG, the LLM, and the agent-learning mechanism -- contributes to its overall effectiveness.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。