一个简单的postman实例

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("武汉");

 

断言成功

 

免费接口api

https://www.jianshu.com/p/e6f072839282

 

posted @ 2019-11-06 13:42  牧阳人  阅读(217)  评论(0编辑  收藏  举报