【问题标题】:How to know if a request is running from collection in test script?如何知道请求是否正在从测试脚本中的集合中运行?
【发布时间】:2022-10-17 08:44:20
【问题描述】:

在邮递员测试脚本中,我如何知道请求是从集合中运行还是仅从请求中运行?

【问题讨论】:

    标签: javascript postman


    【解决方案1】:

    我解析了 Postman 变量并发现:

    postman.__execution.cursor.length
    

    这是运行器将运行的请求数。如果它从集合中运行,“长度”值是集合中的请求数。

    这是功能:

    function isRunningFromCollection(){
        return postman.__execution.cursor.length > 1;
    }
    

    警告:不要为一个请求的集合工作......

    【讨论】:

      猜你喜欢
      • 2012-03-09
      • 2010-11-29
      • 2020-05-21
      • 2013-01-01
      • 2021-06-06
      • 2013-09-19
      • 1970-01-01
      • 1970-01-01
      • 2019-02-04
      相关资源
      最近更新 更多