一句话:通过连续 15 天自动生成并执行百万级测试,揭示 RESTful API 在线测试的潜力与挑战。
在线测试(在生产环境测试 Web API)日益流行,但自动生成测试用例能否扩展到工业规模并用于在线场景尚不明确。本文用 RESTest 对 13 个工业 API 连续 15 天自动生成并执行超 100 万个测试用例;为应对规模,工具转向 200 多个 bot 协作的多 bot 架构。结果发现约 39 万次失败,分诊出 254 个缺陷,65 个已被确认或修复,涉及 Amadeus、Foursquare、Yelp、YouTube 等 API,并推动了缺陷修复和文档更新。结果表明,在线测试有潜力成为工业必备能力,但全面落地仍需克服关键挑战。
Online testing of web APIs—testing APIs in production—is gaining traction in industry. Platforms such as RapidAPI and Sauce Labs provide online testing and monitoring services of web APIs 24/7, typically by re-executing manually designed test cases on the target APIs on a regular basis. In parallel, research on the automated generation of test cases for RESTful APIs has seen significant advances in recent years. However, despite their promising results in the lab, it is unclear whether research tools would scale to industrial-size settings and, more importantly, how they would perform in an online testing setup, increasingly common in practice. In this paper, we report the results of an empirical study on the use of automated test case generation methods for online testing of RESTful APIs. Specifically, we used the RESTest framework to automatically generate and execute test cases in 13 industrial APIs for 15 days non-stop, resulting in over one million test cases. To scale at this level, we had to transition from a monolithic tool approach to a multi-bot architecture with over 200 bots working cooperatively in tasks like test generation and reporting. As a result, we uncovered about 390K failures, which we conservatively triaged into 254 bugs, 65 of which have been acknowledged or fixed by developers to date. Among others, we identified confirmed faults in the APIs of Amadeus, Foursquare, Yelp, and YouTube, accessed by millions of applications worldwide. More importantly, our reports have guided developers on improving their APIs, including bug fixes and documentation updates in the APIs of Amadeus and YouTube. Our results show the potential of online testing of RESTful APIs as the next must-have feature in industry, but also some of the key challenges to overcome for its full adoption in practice.