/api/stores
在邮递员中触发一组不同的数据:
#pre-request script
var managers= pm.globals.get("managers");
var ref= pm.globals.get("ref");
if(!managers && !ref){
managers=[0,1];
ref=["QA0","QA1"];
}
var currentmanager=managers.shift();
pm.globals.set("manager",currentmanager);
pm.globals.set("managers",managers) ;
var currentref=ref.shift();
pm.globals.set("refeng",currentref);
pm.globals.set("ref",ref) ;
#Test script
var managers=pm.globals.get("managers");
var ref=pm.globals.get("ref");
if(managers && managers.length>0 && ref && ref.length>0){
postman.setGlobalVariable("currentmanager",managers.shift());
postman.setGlobalVariable("currentref",ref.shift());
postman.setNextRequest("https://staging-api.toters-api.com/api/stores");
}
else{
postman.clearGlobalVariable("manager");
postman.clearGlobalVariable("managers");
postman.clearGlobalVariable("ref");
postman.clearGlobalVariable("refeng");
}
但是在 2 次迭代中运行所有 API 时,所有在其下/api/stores
运行的 API 都没有在 2 次迭代中运行