for循环中的邮递员setNextRequest没有从Runner调用

集合有两个请求。

  • 发布-创建帐户
  • 发布-创建accountProfile

创建accountProfile将一个accountProfile对象添加到该帐户中。

有13种帐户配置文件类型。

我要做的是创建13个帐户,每种帐户类型一个。

第二种方法是Tests中的Javascript。

现在不用担心硬编码。我待会儿解决。

var acctProfiles = [0,1,4,5,6,19,33,34,35,38,39,40]

for (var p in acctProfiles ) {
    // Create account with that profile
    console.log('creating account');
    postman.setNextRequest("Create account");

    console.log(pm.collectionVariables.get("accountToken"));

    pm.collectionVariables.set("profileType",profiles[p]);

    console.log('creating profile');

    // Now call this request to create the profile
    postman.setNextRequest(); 

}

我在收藏跑步者中运行了这个收藏。 它成功运行了每个请求,但只有一次。
它只使用了数组中的最后一个元素40。 因此,创建了一个具有一个帐户配置文件的帐户,而没有更多内容。

wpk123456 回答:for循环中的邮递员setNextRequest没有从Runner调用

邮递员中的循环不起作用。

每次在 Create AccountProfile 中使用setNextRequest();时,都会在 Create AccountProfile 中输入完整代码后转到 Create Account 不仅执行循环。因此,将仅执行循环中的第一次执行。

您可以通过其他方式实现您的需求。 您可以将数组存储在全局变量中,每次执行 Create AccountProfile 时,您都可以从中删除一项。

本文链接:https://www.f2er.com/2799794.html

大家都在问