在postman中执行测试用例通过后,将postman中的用例导出,并用Newman执行
1、安装newman
安装node.js
https://nodejs.org/en/
node -v 查看是否安装好了
npm install --global --production windows-build-tools
npm install -g newman
newman -v 查看是否安装好了
npm install newman-reporter-html
2、执行Newman
导出请求、环境变量
命令行运行collection
cmd进入到collection的json文件的目录下,输入指令
newman run postmanEcho.postman_collection.json
例子1,通过newman 运行postman导出的test1.json文件,并生成多种测试报告(json,junit的xml,html):
newman run c:\test1.json –reporters cli,html,json,junit –reporter-json-export jsonOut.json –reporter-junit-export xmlOut.xml –reporter-html-export htmlOut.html
例子2,运行https://www.getpostman.com/collections/cb0cea0af1467c8008fb(postman生成的 )中的所有api,并使用env.json作为环境变量和globals.json作为全局变量,并使用外部data.
1、安装newman
安装node.js
https://nodejs.org/en/
node -v 查看是否安装好了
npm install --global --production windows-build-tools
npm install -g newman
newman -v
npm install newman-reporter-html
2、执行Newman
导出请求、环境变量
命令行运行collection
cmd进入到collection的json文件的目录下,输入指令
newman run postmanEcho.postman_collection.json
例子1,通过newman 运行postman导出的test1.json文件,并生成多种测试报告(json,junit的xml,html):
newman run c:\test1.json –reporters cli,html,json,junit –reporter-json-export jsonOut.json –reporter-junit-export xmlOut.xml –reporter-html-export htmlOut.html
例子2,运行https://www.getpostman.com/collections/cb0cea0af1467c8008fb(postman生成的 )中的所有api,并使用env.json作为环境变量和globals.json作为全局变量,并使用外部data.
