我正在尝试使用Postman来验证API。我可以没有任何问题地验证单个请求,并获得所需的输出。但是,我现在想做一个负载测试,并运行相同的调用5次。
我尝试使用for和while循环,但Postman给出了一个错误。
while i < 5
{
"FirstName": "TestFN",
"LastName": "TestLN",
"orderID": *I want to update this based on the value of i --> "Concat(100,i)"*
}发布于 2021-07-17 05:30:06
在前置请求中添加:
let count = pm.variables.get("count") ? pm.variables.get("count") : 5
if(count-1){
count -= 1
postman.setNextRequest(pm.info.requestName)
pm.variables.set("count",count)
}else{
// if you don't want to execute remaining
//postman.setNextRequest(null)
}当使用newman或集合运行器运行时,这将运行请求5次,如注释中提到的@Danny
https://stackoverflow.com/questions/68414253
复制相似问题