我正试图在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');
答案 0 :(得分:0)
多数民众赞成在每个请求中只能添加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');
});
}