【问题标题】:How to parameterize http methods in Jmeter using CSV data config?如何使用 CSV 数据配置在 Jmeter 中参数化 http 方法?
【发布时间】:2015-07-30 16:26:09
【问题描述】:

如何使用CSV数据配置参数化Jmeter中的http方法

我做了什么: created an HTTP Request Sampler (method POST),但我需要从包含方法的 csv 文件创建 http 请求采样器。

【问题讨论】:

    标签: apache jmeter parameterized


    【解决方案1】:

    您可以使用 Beanshell 预处理器更改 HTTP 方法。

    为您现有的 HTTP 请求添加一个 Beanshell 预处理器。您的默认 HTTP 方法是 POST。

    现在,只要 csv 变量 'method' 为 'GET',让我们将其更改为 GET

    if(vars.get("method").equalsIngoreCase("GET")){
        sampler.setMethod("GET");  //this will change current sampler's http method from POST to GET. 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-06
      • 1970-01-01
      • 2023-04-08
      • 1970-01-01
      相关资源
      最近更新 更多