arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.08007cs.SE
收藏

基于日志的、业务感知的REST API测试

Log-based, Business-aware REST API Testing

Nanjing University(南京大学);Tencent(腾讯)

Ding Yang, Ruixiang Qian, Zhao Wei, Zhenyu Chen, Chunrong Fang

AI总结:

本文提出LoBREST,通过利用历史请求日志和业务约束,有效测试复杂业务功能,优于现有工具,在17个真实服务中检测到108个5XX错误。

摘要:

REST APIs使微服务之间协作。REST API中的单个故障可能使整个微服务系统崩溃并造成重大经济损失,因此REST API测试至关重要。有效测试REST API需要充分执行其背后的功能。为此,现有技术利用REST规范(如Swagger或OpenAPI)生成测试用例。使用从规范中提取的资源约束,这些技术在测试简单、业务不敏感的功能(如资源创建、检索、更新和删除)时效果良好。然而,对于复杂、业务敏感的功能,这些基于规范的技术往往不足,因为执行此类功能需要额外的业务约束,通常不在REST规范中。在本文中,我们提出了LoBREST,一种基于日志、业务感知的REST API测试技术,利用历史请求日志(HRLogs)有效执行REST API背后业务敏感的功能。为了获得保留清洁和完整业务约束的紧凑操作序列,LoBREST首先采用局部切片策略将HRLogs分成更小的切片。然后,为了确保获得的切片的有效性,LoBREST通过两步增强:(1)添加缺失的切片操作;(2)在切片内完成缺失的资源。最后,为了提高测试充分性,LoBREST使用这些增强的切片作为初始种子进行业务感知的模糊测试。LoBREST在17个真实服务中优于八个工具(包括Arat-rl、Morest和Deeprest)。它在16个服务上实现了顶级的操作覆盖率,在15个服务上实现了行覆盖率,平均改进率为2.1倍和1.2倍。LoBREST检测到108个5XX错误,包括38个其他工具未发现的错误。

英文摘要:

REST APIs enable collaboration among microservices. A single fault in a REST API can bring down the entire microservice system and cause significant financial losses, underscoring the importance of REST API testing. Effectively testing REST APIs requires thoroughly exercising the functionalities behind them. To this end, existing techniques leverage REST specifications (e.g., Swagger or OpenAPI) to generate test cases. Using the resource constraints extracted from specifications, these techniques work well for testing simple, business-insensitive functionalities, such as resource creation, retrieval, update, and deletion. However, for complex, business-sensitive functionalities, these specification-based techniques often fall short, since exercising such functionalities requires additional business constraints that are typically absent from REST specifications. In this paper, we present LoBREST, a log-based, business-aware REST API testing technique that leverages historical request logs (HRLogs) to effectively exercise the business-sensitive functionalities behind REST APIs. To obtain compact operation sequences that preserve clean and complete business constraints, LoBREST first employs a locality-slicing strategy to partition HRLogs into smaller slices. Then, to ensure the effectiveness of the obtained slices, LoBREST enhances them in two steps: (1) adding slices for operations missing from HRLogs, and (2) completing missing resources within the slices. Finally, to improve test adequacy, LoBREST uses these enhanced slices as initial seeds to perform business-aware fuzzing. LoBREST outperformed eight tools (including Arat-rl, Morest, and Deeprest) across 17 real-world services. It achieved top operation coverage on 16 services and line coverage on 15, averaging 2.1x and 1.2x improvements over the runner-up. LoBREST detected 108 5XX bugs, including 38 found by no other tool.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑