0

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

提前感谢所有帮助。

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');

收藏夹文件结构截图

4

1 回答 1

1

没错 -postman.setNextRequest()每个请求您只能添加一个。但是,我已经设法使用多个条件执行多个setNextRequest()并链接所有请求。if根据请求名称,邮递员将决定接下来要发布哪个请求。

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');
    });
} 
于 2018-05-31T10:44:26.227 回答