arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2112.08267cs.SE
收藏

收获生产GraphQL树以检测模式故障

Harvesting Production GraphQL Queries to Detect Schema Faults

Louise Zetterlund, Deepika Tiwari, Martin Monperrus, Benoit Baudry

摘要:

GraphQL是设计Web API的新范式。尽管它越来越受欢迎,但很少有技术来验证GraphQL API的实现。我们提出了一种基于GraphQL查询的新测试方法,这些查询在用户与生产中的应用程序交互时被记录。我们的核心动机是生产查询捕获应用程序的实际使用情况,并且已知会触发开发人员可能无法测试的行为。对于每个记录的查询,都会生成一个测试来断言GraphQL响应相对于模式的有效性。我们在一个名为AutoGraphQL的工具中实现了我们的方法,并在两个现实世界的案例研究中对其进行了评估,这两个案例研究在其领域和技术堆栈中是不同的:一个用Python实现的开源电子商务应用程序Saleor,以及一个工业案例研究,这是一个基于PHP的金融网站Frontapp。AutoGraphQL成功地为这两个应用程序生成了测试用例。生成的测试覆盖了Saleor模式的26.9%,包括原始测试套件未执行的API部分,以及Frontapp模式的48.7%,检测到8个模式错误,这要归功于生产查询。

英文摘要:

GraphQL is a new paradigm to design web APIs. Despite its growing popularity, there are few techniques to verify the implementation of a GraphQL API. We present a new testing approach based on GraphQL queries that are logged while users interact with an application in production. Our core motivation is that production queries capture real usages of the application, and are known to trigger behavior that may not be tested by developers. For each logged query, a test is generated to assert the validity of the GraphQL response with respect to the schema. We implement our approach in a tool called AutoGraphQL, and evaluate it on two real-world case studies that are diverse in their domain and technology stack: an open-source e-commerce application implemented in Python called Saleor, and an industrial case study which is a PHP-based finance website called Frontapp. AutoGraphQL successfully generates test cases for the two applications. The generated tests cover 26.9% of the Saleor schema, including parts of the API not exercised by the original test suite, as well as 48.7% of the Frontapp schema, detecting 8 schema faults, thanks to production queries.

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

↑