首页 > 其他 > 详细

一个简单的postman实例

时间:2019-11-06 14:37:09      阅读:102      评论:0      收藏:0      [点我收藏+]

https://blog.csdn.net/zsj777/article/details/102456224,查找免费api

1、找一个免费的api,获取天气预报

http://t.weather.sojson.com/api/weather/city/101220101

 

2、get请求,设置变量,在pre-request Script设置

http://{{variable_key}}/api/weather/city/101200101

pre-request Script

console.log(‘1111‘)

postman.clearEnvironmentVariable("variable_key");

postman.setEnvironmentVariable("variable_key", "t.weather.sojson.com");

 

3、断言,在Tests里面

tests["Body matches string"] = responseBody.has("武汉");

 

断言成功

 

一个简单的postman实例

原文:https://www.cnblogs.com/mobies/p/11804664.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!