gpt4 book ai didi

postman : how to rerun a subset of postman request multiple times

转载 作者:行者123 更新时间:2023-12-05 06:59:55 24 4
gpt4 key购买 nike

我有一个 postman 请求,顺序如下

  1. 获取请求
  2. 获取请求
  3. POST 请求
  4. POST 请求<<<
  5. POST请求<<<只需要重复4,5,6 - 10次
  6. POST 请求<<<

POST 请求 4、5 和 6 需要重复(比如 10 次)

我尝试了如下请求的副本....

  1. 获取请求
  2. 获取请求
  3. POST 请求
  4. POST 请求
  5. POST 请求
  6. POST 请求
  7. POST 请求 4 - 复制 <<<
  8. POST 请求 5 - 复制 <<< 我复制了 4、5、6 :(
  9. POST 请求 6 - 复制 <<<

有比复制更好的方法吗?

最佳答案

postman.setNextRequest("request_name") 应该对您有所帮助。

注意:只有当您使用 postman runner 运行集合并且集合中的请求名称必须是唯一的时,这才有用。

在您的情况下,将您集合中的请求重命名为

GET Request 1
GET Request 2
POST Request 3
POST Request 4
POST Request 5
POST Request 6

并将以下代码放在POST Request 6

的测试选项卡中
var maxCount = pm.environment.get("maxCount"); //number of times you want to repeat requests 4,5,6
var currentCount = pm.environment.get("currentCount"); //set this to 0 when starting the test
if (currentCount < maxCount) {
currentCount = currentCount + 1;
pm.environment.set("currentCount", currentCount);
postman.setNextRequest("POST Request 4")
}

关于 postman : how to rerun a subset of postman request multiple times,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64261948/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com