【问题标题】:Postman setNextRequest and workflow conditional workflowPostman setNextRequest 和工作流条件工作流
【发布时间】:2019-04-05 08:36:47
【问题描述】:

我正在尝试使用 setNextRequest 创建条件工作流。只有当当前调用的状态码为 201 时,此工作流才应执行后续 API 调用

我的测试看起来像这样

var returnData = JSON.parse(responseBody);
tests["status code"] = (responseCode.code === 201);
if (responseCode.code == 201) {
    postman.setNextRequest('ConfigurationModel-Module');
}

但即使我的 API 响应是 409,后续 API 调用也会在 postman runner 中触发

【问题讨论】:

  • 我看到的有点奇怪。第一个请求进入,失败(给出 409)测试但触发下一个请求。基本上 if (responseCode.code == 201) 没有得到评估!!!

标签: rest postman-testcase


【解决方案1】:

根据你在做什么,你可以添加一个 else 语句

else
 postman.setNextRequest(null);

【讨论】:

    猜你喜欢
    • 2018-07-21
    • 1970-01-01
    • 2010-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多