接口测试工具-Postman之二(与Jenkins持续集成)

如文中的图片没法查看,可点击“http://note.youdao.com/noteshare?id=1e0d2f5a4203167a7d7b571c01094da6”查看本人源笔记记录。
Postman在以前已经简单介绍过,不管是开发仍是测试是一个很不错的接口测试工具,Postman简单且易上手。但若是要想进一步实际持续集成中的接口自动化测试仍是须要与Jenkins相结合应用。所以本次练习就是如何:实现接口自动化测试Postman与Jenkins持续集成(参考资料:http://www.noobyard.com/article/p-vztvxwer-bk.htmlhtml

优势:实现持续接口自动化测试
所需环境:nodejs+newman
nodejs安装:官网下载安装-http://nodejs.cn/download/
安装完成后查看版本命令:
node -v
npm -vnode

newman命令安装:sudo npm install newman –globalweb

newman run /Volumes/Transcend/jenkins.postman_collection.json
/jenkins.postman_collection.json 为postman的import保存文件。npm

问题:
一、带环境变量运行命令
newman run /Volumes/Transcend/bapp-登陆.postman_collection.json -e /Volumes/Transcend/test.postman_environment.json json

二、运行时报错:line 2: newman: command not found
问题:找不到newman运行,须要环境变量配置
解决办法:输出环境“echo $PTATH”,把输出的环境变量放到“将PATH值所有复制,而后贴到 jenkins 系统管理 – 系统设置 –Environment variables – 键:PATH 值:刚才PATH的值”
再次运行“newman run /Volumes/Transcend/jenkins.postman_collection.json”后的结果以下:app

三、运行生成报告文件
“newman run /Volumes/Transcend/jenkins.postman_collection.json –reporters html –reporter-html-export report.html”
注:本人运行完成后没有在mac本上生成文件report.html文件,缘由还未知,后续继续跟踪缘由。svg