var env= {"host":"uat","tipperId":1};
var envJson ={
"uat":{
"userName":"XXXX",
"password":"YYYY",
"url":"xxxx.ut.com"
},
"prod":{
"userName":"XXXX",
"password":"YYYY",
"url":"xxxx.pt.com"
},
"local":{
"userName":"test",
"password":"test_dev",
"url":"http://localhost:8081"
}
};
var map = new Map();
map.set("uat",envJson.uat);
map.set("prod",envJson.prod);
map.set("local",envJson.local);
pm.environment.set("tipperId", env.tipperId);
pm.environment.set("domain", map.get(env.host).url);
pm.environment.set("userName", map.get(env.host).userName);
pm.environment.set("password", map.get(env.host).password);
//设置成环境变量
//将数据解析成json格式
var data=JSON.parse(responseBody);
//获取access_token值
var access_token=data.token;
//设置成环境变量
pm.environment.set("access_token", "Bearer "+access_token);