1. 本机没有安装node.js,先安装
1.1 去官网下载
地址1:https://nodejs.org/en/download/ ,我下载的是 【Windows 安装包(.msi)】
地址2:https://nodejs.org
1.2 检测PATH环境变量是否配置了Node.js
检测环境变量是否已配置node.js点击开始 -- 运行 -- cmd -- 输入"path"
1.3 检查Node.js版本
检查Node.js版本.png命令:node --version 或 node -v
2. 安装Newman
2.1 全局安装
安装Newman.pngcmd中敲入:npm install -g newman
2.2 安装报告newman-reporter-html
安装报告.pngcmd 输入:npm install -g newman-reporter-html
样式2:npm install -g newman-reporter-htmlextra
3. 使用
3.1 从postman下载脚本到本机
下载测试用例脚本.png3.2 下载环境变量
下载环境变量.png3.3 本机调试报告样式
本机调试命令.png 运行完成后导出的目标文件夹已包含了该报告newman run D:\AutoPresent\0.Login.json -e D:\AutoPresent\1.Test_enVirables.json -r html --reporter-html-export Test1218.html
newman run D:\AutoPresent\0.Login.json -e D:\AutoPresent\1.Test_enVirables.json -r htmlextra --reporter-html-export Test1218.html
3.4 去 jenkins 集成
新建一个构建,然后在构建的地方,配置 windows的批处理命令,点击立即构建,查看控制台输出,在导出的目标文件夹下同样会生成报告
cd /
cd C:\Users\Queenie\AppData\Roaming\npm
newman run D:\newman_qdd.postman_collection.json -e D:\qdd_bg_enviroment.postman_environment.json --reporters html --reporter-html-export D:\html001.html
网友评论