0
点赞
收藏
分享

微信扫一扫

newman执行Postman测试用例

weipeng2k 2022-04-19 阅读 76

1、安装nodeJS环境:http://nodejs.cn/download/

安装直接双击运行即可,安装完之后,检查一下node环境变量

打开cmd窗口,运行node -v 和npm -v 两个命令,分别你能查看到node和npm的版本信息即可

2、使用npm安装newman工具,用于完成postman脚本的执行

npm install newman -g --resgister https://registry. npm.taobao.org

使用淘宝镜像的npm镜像下载newman工具

检查newman的安装:npm config get prefix 查看prefix目录,也就是npm安装内容的目录,检查一下newman是不是已经安装好了并且将这个目录配置到环境变量PATH里,方便进行newman使用

最后运行newman得到如下结果即安装成功

3、通过newman执行postman的collection

需要的内容:环境变量、测试集collection、测试数据csv等

需要在postman中导出collection和环境变量environments。不仅可以用于newman执行,还可以进行导入,查看别人的测试集。

 

注意:在导出的时候,最好创建一个文件夹管理,不要用中文,同时,导出的文件最好也不要中文名。

执行方式newman run xxxx.collection.json -e xxxx.environments.json

4、newman生成html测试报告:

        1)通过以下命令安装newman的html报告插件。

                npm install -g newman-reporter-html

        2)使用的时候,先声明-r参数带上html格式,然后使用 --reporter-html-export参数指定html文件生成位置。

         3)newman添加数据驱动测试用例执行collection

 

 

举报

相关推荐

0 条评论