一句话:提出基于动态不变式检测的 RESTful API 测试预言自动生成技术,扩展 Daikon 并从历史请求响应中学习输出性质。
近年来 RESTful API 测试用例生成工具发展迅速,但它们通常只能发现崩溃(服务器错误)和违反 API 规范的问题,无法判断响应是否符合预期。本文提出一种通过检测不变式来自动生成 RESTful API 测试预言的技术:分析历史 API 请求及其对应响应,学习输出应满足的期望性质。作者扩展了流行的动态不变式检测工具 Daikon,使其适用于 RESTful API。初步评估覆盖 6 个工业 API 的 8 个操作,总体精度为 66.5%,其中 2 个操作达到 100%;此外,该方法在 Amadeus、GitHub 和 OMDb 等拥有数百万用户的 API 中发现 6 个可复现 bug。
Test case generation tools for RESTful APIs have proliferated in recent years. However, despite their promising results, they all share the same limitation: they can only detect crashes (i.e., server errors) and disconformities with the API specification. In this paper, we present a technique for the automated generation of test oracles for RESTful APIs through the detection of invariants. In practice, our approach aims to learn the expected properties of the output by analysing previous API requests and their corresponding responses. For this, we extended the popular tool Daikon for dynamic detection of likely invariants. A preliminary evaluation conducted on a set of 8 operations from 6 industrial APIs reveals a total precision of 66.5% (reaching 100% in 2 operations). Moreover, our approach revealed 6 reproducible bugs in APIs with millions of users: Amadeus, GitHub and OMDb.