如何执行多个postman.setNextRequest

How to execute multiple postman.setNextRequest

我正在尝试在 Postman 中执行以下操作。但是,我没有看到所有请求都得到执行。只有 2 个请求被执行,即触发所有其余请求的请求和第二个请求 ReadByQuery_PODOCUMENT rest 无法执行。

在此先感谢您的帮助。

postman.setNextRequest('ReadByQuery_PODOCUMENT');
postman.setNextRequest('Read_PODOCUMENTENTRY');
postman.setNextRequest('Create PO Trxn 3.0 - With Deliver to tag at header over ridden');
postman.setNextRequest('ReadByQuery_PODOCUMENT');
postman.setNextRequest('Read_PODOCUMENTENTRY');
postman.setNextRequest('Create PO Trxn 3.0 - With No header Deliver to tag specified');
postman.setNextRequest('ReadByQuery_PODOCUMENT');
postman.setNextRequest('Read_PODOCUMENTENTRY');

没错 - 每个请求只能添加一个 postman.setNextRequest()。但是,我设法执行了多个 setNextRequest() 并使用多个 if 条件链接了所有请求。根据请求名称,post人将决定下一个 post 的请求。

var jsonData = JSON.parse(responseBody); //Parse JSON responseBody
var req_name = pm.variables.get("request_name"); //Get the requestname
var RECORDNO = pm.environment.set("RECORDNO", jsonData[0].RECORDNO); //Set the record n.o
    
//TC001 - API 3.0 Verify "Deliver to" at the header is set to blank
if (req_name === "Create_Purchase_Order 3.0 - Deliver to blank") {
    pm.test("Verify Header Deliver to is autopopulated with default value", function() {
        pm.expect(jsonData[0]["DELIVERTO.CONTACTNAME"]).to.eql("Hal");
        postman.setNextRequest('ReadByQuery_PODOCUMENTENTRY');
    });
}