gpt4 book ai didi

php - 我可以在非 Nodejs 应用程序中使用 swagger 测试模板吗?

转载 作者:行者123 更新时间:2023-12-02 04:12:54 25 4
gpt4 key购买 nike

我正在为 php 应用程序构建一个 api 测试套件。现在该应用程序正在使用 swagger 注释,我可以轻松创建 swagger.json。但从the swagger test template来看,看来我必须首先使用 swagger 节点创建一个 Nodejs 应用程序?有没有办法可以跳过该步骤并使用我的 php 应用程序?

编辑:我已经使用 swagger-php 启动并运行了 swagger 文档。只是想知道是否可以使用 swagger-test-template 而不使用 swagger-node。

最佳答案

我是 swagger-test-templates 的贡献者之一。 (我之前没有回答过任何问题,所以请耐心等待)

我是通过最近有人打开的一个 Github 问题来解决这个问题的!我在那里回答了它,但我将在这里复制它并进一步扩展它。我希望它有帮助。如果我没有完全回答您的问题,请跟进。

Simple answer: No, it is not exclusively for Node.js APIs or swagger-node.

Longer answer: You can use STT like any other Node.js module in a Node.js project, completely on its own. See the Readme or the test files for an example of how to run it standalone. Furthermore, the API doesn't have to be implemented in Node.js for a STT generated test to target it with an HTTP request. You have to use Node.js to utilize this module's functionality, but as long as you point the tests at a running server (localhost:1337, my.api.test.net) the backend implementation doesn't matter. The caveat here is that this module was designed to run with mocha which is a Node.js test runner/framework. So the tests have to be in a Node.js project, but the server implementation doesn't.

关于php - 我可以在非 Nodejs 应用程序中使用 swagger 测试模板吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35657134/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com