1.安装newman

npm install -g newman

安装node.js

Node -v  node -v 安装时会默认添加到环境变量中)

2. 验证

New man –version #Should show the latest version of Newman

3. postman导出文件和环境json

 Newman(二)之环境搭建

Newman(二)之环境搭建

 

文件名分别为postman_collection.jsonpostman_environment.json

4.newman测试运行 命令行输入newman run D:\postman_collection.json -e D:\postman_environment.json

 Newman(二)之环境搭建

5.访问Jenkinshttp://localhost:8080/jenkins

 建立自由式项目

 Newman(二)之环境搭建

6.选择构建Execute shell输入commandnewman run D:\postman_collection.json -e D:\postman_environment.json

 Newman(二)之环境搭建

 

7.立即构建

newman -c D:\postman_collection.json -e D:\postman_environment.json  –exitCode 1

8. 控制台输出

 Newman(二)之环境搭建

 

控制台输入可能碰到以下问题

1newman -c D:\postman_collection.json -e D:\postman_environment.json  –exitCode 1

 Newman(二)之环境搭建

识别不了 –exitCode 1

2newman -c D:\postman_collection.json -e D:\postman_environment.json  –exitCode 1

 Newman(二)之环境搭建

原因不识别new -c改成newman run就对了

3)报错

 Newman(二)之环境搭建

json放在这个路径下就可以了

4) 正确命令newman run D:\postman_collection.json -e D:\postman_environment.json;乱码

 Newman(二)之环境搭建

解决方法:直接新建一个系统变量名为JAVA_TOOL_OPTIONS ;变量值为-Dfile.encoding=UTF-8 

保存并重启jenkins;可以通过查看系统管理系统信息–file.encoding(管理文件中的编码)已经修改,由GBK修改为UTF-8,但是sun.jnu.encoding(管理文件名的编码)没有修改

(如果想修改sun.jnu.encoding ,将之前设置改为JAVA_TOOL_OPTIONS ;变量值为-sun.jnu.encoding=UTF-8 即可)两者只能改其一

 Newman(二)之环境搭建

 Newman(二)之环境搭建

 

4)发现tomcat启动时候乱码了(tomatjenkins集成最好不要用war包)

Newman(二)之环境搭建 

在配置文件D:\tomcat\bin\startup.bat加入set JAVA_OPTS=-server -Dfile.encoding=gbk修复了

5)然后去看文件的错就可以了

相关文章:

  • 2021-04-04
  • 2021-11-23
  • 2021-07-10
  • 2022-01-09
  • 2021-03-31
  • 2021-11-04
猜你喜欢
  • 2021-10-17
  • 2022-01-07
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2021-12-18
  • 2021-06-10
相关资源
相似解决方案