文字收藏:https://www.cnblogs.com/powertoolsteam/archive/2018/10/31/9881398.html
ssh root@106.13.31.247
安装jekins
https://www.cnblogs.com/loveyouyou616/p/8714544.html
坑:安装Jenkins时不能联网安装插件问题解决
https://blog.csdn.net/txyzqc/article/details/77885367
安装好以后启动jenkins
service jenkins start
https://www.cnblogs.com/cerofang/p/9981698.html
npm config set -g registry https://registry.npm.taobao.org
npm install -g newman
npm install -g newman-reporter-html
scp -r /Users/mac/Documents/data/test/newman/newman.postman_collection.json root@106.13.31.247:/root/yangchun/newman/newman.postman_collection.json
2.构建脚本
#!/bin/bash -il
cd /opt/test/newman
newman run newman.postman_collection.json -e newman.postman_environment.json --reporters cli,html --reporter-html-export newman/index.html
#使用模板newman run -e my.environment.json -g my.globals.json --reporters cli,html --reporter-html-template templates/htmlreqres.hbs --reporter-html-export my_report.html my.collection.postman.json
#资料 https://github.com/MarcosEllys/awesome-newman-html-template
构建脚本加上
#!/bin/bash -il
#服务器上查找jenkins
find / -name "jenkins"
#编辑文件 /etc/sysconfig/jenkins
JENKINS_USER=root
重启 jenkins
service jenkins restart
ERROR: Specified HTML directory '/var/lib/jenkins/workspace/tujia/newman' does not exist.
Build step 'Publish HTML reports' changed build result to FAILURE
Finished: FAILURE
输出文件,放置于 jenkins workspace 中;脚本命令修改为
#!/bin/bash -il
cd /opt/test/newman
newman run newman.postman_collection.json -e newman.postman_environment.json --reporters cli,html --reporter-html-export /var/lib/jenkins/workspace/tujia/newman/index.html
解决方案:https://testerhome.com/topics/11957?locale=en
构建成功了,但是格式太丑
安装 Groovy 插件,重启 jenkins。请自行百度
使用管理员账号登录 jenkins,进入项目配置页 ==> Post Steps ==> 添加 Execute system Groovy script ==> 输入 System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") ==> 保存
导出 html report 成功啦,接下来就是设置定时任务和邮件啦