Newman帮助指定集合,环境和全局变量可以作为路径或URL传递。我可以看到如何从Postman获取收集URL(通过转到Share> Collection Link) 如何在Postman中获取环境和全局的URL,以便将它们传递给newman?
答案 0 :(得分:0)
从命令行使用newman https://stackoverflow.com/a/383699/8229192:
-e <source>, --environment <source>
Specify an environment file path or URL. Environments provide a set
of variables that one can use within collections. Read More
-g <source>, --globals <source>
Specify file path or URL for global variables. Global variables are
similar to environment variables but has a lower precedence and can
be overridden by environment variables having same name.
如果您将newman用作command line options,请为newman.run()提供环境和全局选项:
newman.run({environment: <source>, globals: <source>}, callback)
答案 1 :(得分:0)
https://www.npmjs.com/package/newman
将Newman与Postman Pro API结合使用 1生成API密钥 2从以下网址获取您的收藏列表:https://api.getpostman.com/collections?apikey= $ apiKey 3通过它获取收集链接uid:https://api.getpostman.com/collections/ $ uid?apikey = $ apiKey 4从以下地址获取环境URI:https://api.getpostman.com/environments?apikey= $ apiKey 5使用在步骤3和4中获取的集合和环境URI,按如下方式运行集合:
newman run&#34; https://api.getpostman.com/collections/ $ uid?apikey = $ apiKey&#34; \ --environment&#34; https://api.getpostman.com/environments/ $ uid?apikey = $ apiKey&#34;
答案 2 :(得分:0)
使用Postman桌面应用程序,请尝试以下步骤-
View in Web
。答案 3 :(得分:0)
通过邮递员,我将环境导出为json文件,然后将该文件托管在网络服务器上。
答案 4 :(得分:0)
我不知道如何获取传递给纽曼的Postman Globals URL? 我只能获取集合和环境URL。