如何使用 swagger (swagger.yaml) 使 API 测试更容易?

How to use swagger (swagger.yaml) to make API testing easier?

我正在使用 swagger 来记录我的 API。现在我想为 api 的端到端测试编写 python 测试。 swagger.yaml 文件将如何帮助我完成这个过程?

可以使用Swagger Codegen生成PythonAPI客户端,自带测试文件

以下是一些由 Swagger Codegen 自动生成的测试文件示例

https://github.com/swagger-api/swagger-codegen/tree/master/samples/client/petstore/python/test

然后您可以使用您要进行的实际测试更新测试文件。