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

时间:2017-06-02 02:59:58

标签: 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运行完成后结束。我认为它出于某种原因终止了控制台。

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

1 个答案:

答案 0 :(得分:1)

你只需要使用"来电"在newman命令之前如下:

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%