postman - 批量运行多个 Newman (Postman) 测试集合

标签 postman web-api-testing postman-collection-runner

我已经定义了几个 Postman 测试集合/文件夹及其相关的测试数据文件。通过 Postman Collection Runner 和 Newman 单独运行它们可以正常工作。我想一起批处理多个运行,就像 Windows 中的这个 .bat:

SET postman_collection=Regression.postman_collection.json
SET postman_environment=Development.postman_environment.json

SET postman_folder="Order details"
SET postman_data="orders.json"
newman run %postman_collection% -r html,cli -e %postman_environment% --folder %postman_folder% -d %postman_data%

SET postman_folder="Fuzzy Search"
SET postman_data="fuzzy search regression.csv"
newman run %postman_collection% -r html,cli -e %postman_environment% --folder %postman_folder% -d %postman_data%

SET postman_folder="Sorting"
SET postman_data=""
newman run %postman_collection% -r html,cli -e %postman_environment% --folder %postman_folder% -d %postman_data%

但是,执行在第一次 newman 运行完成后结束。我认为它出于某种原因终止了控制台。

我怎样才能实现上面我想做的事情?我是否错误地构建了我的测试?任何帮助表示赞赏!

最佳答案

您只需要在 newman 命令之前使用“call”,如下所示:

SET postman_collection=Regression.postman_collection.json
SET postman_environment=Development.postman_environment.json

SET postman_folder="Order details"
SET postman_data="orders.json"

call newman run %postman_collection% -r html,cli -e %postman_environment% --folder %postman_folder% -d %postman_data%

SET postman_folder="Fuzzy Search"
SET postman_data="fuzzy search regression.csv"

call newman run %postman_collection% -r html,cli -e %postman_environment% --folder %postman_folder% -d %postman_data%

关于postman - 批量运行多个 Newman (Postman) 测试集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44320112/

相关文章:

testing - 如何使用 Postman Runner 多次测试同一个端点

postman - 如何查看Postman Collection Runner中的回复?

json - 如何在 Postman 中发布文件和 json 数据?

ubuntu - 如何在 Ubuntu 16.04 LTS 64 位上安装/启动 Postman native v4.10.3?

testing - 如何在 Postman 中根据请求设置变量

c# - 断言 JSON JArray Api 响应

azure - Postman 集合访问 Azure 虚拟网络中的 API 的推荐方式?

postman - postman 请求正文中的文件未保存在集合中

javascript - 当字段名称包含 @ 字符时,如何从 JSON 响应中提取数据

javascript - 如何封装mocha `expect()`代码?