【问题标题】:Batch running multiple Newman (Postman) test collections批量运行多个 Newman (Postman) 测试集合
【发布时间】:2017-11-03 08:16:19
【问题描述】:

我已经定义了几个 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 运行完成后执行结束。我认为它出于某种原因终止了控制台。

我怎样才能实现上面想要做的事情?我的测试结构不正确吗?任何帮助表示赞赏!

【问题讨论】:

  • 您是否尝试过从 js 文件中执行相同操作并在节点中运行 js?
  • 我现在正在尝试这个。我希望我可以把一个快速的批处理文件放在一起。谢谢!

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


【解决方案1】:

你只需要在 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%

【讨论】:

    猜你喜欢
    • 2015-10-12
    • 2021-10-29
    • 2020-08-29
    • 2020-02-20
    • 2018-05-26
    • 2021-04-20
    • 2017-08-17
    • 2021-08-25
    • 2019-03-29
    相关资源
    最近更新 更多