postman获取变量

case 一

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

 pre-Script

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

Tests

var response = JSON.parse(responseBody);
console.log("response:"+response);

var status=response.status
console.log("status:"+status);
pm.environment.set(" variable_key1", "不要说话");

case二

https://api.apiopen.top/searchMusic?name={{variable_key1}}

 pre-Script

Tests

var response = JSON.parse(responseBody);

var author=response.result[0].author;
console.log("author:"+author);
 
 
 

猜你喜欢

转载自www.cnblogs.com/mobies/p/11828057.html