postman 分享
2021-02-08 本文已影响0人
微笑的AK47
主要以下内容
1.postman 接口关联
2.断言
3.输出报告
1.postman 接口关联
接口1 http://apis.juhe.cn/simpleWeather/query?city=南京&key=07b3b6dfb94c3f67d968c08a3eab356f
接口2 http://apis.juhe.cn/simpleWeather/query?city={{city}}&key=07b3b6dfb94c3f67d968c08a3eab356f
接口2需要从接口1中返回的值中取值
![](https://img.haomeiwen.com/i11448275/84dbf23ed75fc7de.png)
![](https://img.haomeiwen.com/i11448275/d3b7fc6ee708a958.png)
![](https://img.haomeiwen.com/i11448275/7c8c4e610b90280d.png)
接口2 使用接口1 返回的值作为参数
![](https://img.haomeiwen.com/i11448275/37ef09a4b302f430.png)
2.断言
![](https://img.haomeiwen.com/i11448275/7bbd924d01fd16a6.png)
3.输出报告
1 下载安装node.js
2运行npm install -g newman 命令,再运行 newman -v 命令检查安装
![](https://img.haomeiwen.com/i11448275/0abea001812baee6.png)
3运行npm install newman-reporter-html命令安装html插件
![](https://img.haomeiwen.com/i11448275/72cbfdd607a5cbe7.png)
4.导出接口
![](https://img.haomeiwen.com/i11448275/6fa2c724d8b8af78.png)
5.运行 newman run C:\Users\xxxx\Desktop\mall.json -r html --reporter-html-export C:\Users\winshang\Desktop\mall.html命令回车即可生成报告如下图
![](https://img.haomeiwen.com/i11448275/0cd19f5ce2e16b4f.png)