Understanding the behaviour of a system's API can be hard. Giving users access to relevant examples of how an API behaves has been shown to make this easier for them. In addition, such examples can be used to verify expected behaviour or identify unwanted behaviours. Methods for automatically generating examples have existed for a long time. However, state-of-the-art methods rely on either white-box information, such as source code, or on formal specifications of the system behaviour. But what if you do not have access to either? e.g., when interacting with a third-party API. In this paper, we present an approach to automatically generate relevant examples of behaviours of an API, without requiring either source code or a formal specification of behaviour. Evaluation on an industry-grade REST API shows that our method can produce small and relevant examples that can help engineers to understand the system under exploration.
翻译:理解系统API的行为可能具有挑战性。已有研究表明,为用户提供API行为相关的示例有助于降低其理解难度。此外,此类示例还可用于验证预期行为或识别非预期行为。自动生成示例的方法早已存在,但现有先进方法主要依赖于白盒信息(如源代码)或系统行为的正式规约。但若两者均不可获取(例如与第三方API交互时)该如何处理?本文提出了一种无需源代码或行为正式规约即可自动生成API行为相关示例的方法。在工业级REST API上的评估表明,我们的方法能够生成精简且相关的示例,帮助工程师理解待探索的系统。