-->

如何使用CSV数据配置,以参数化的JMeter HTTP方法?(How to parameteriz

2019-10-24 08:07发布

如何使用CSV数据配置 ,以参数化的JMeter HTTP方法

我做了什么: created an HTTP Request Sampler (method POST) ,但我需要从一个CSV文件中包括的方法也创造了http请求采样。

Answer 1:

您可以更改使用BeanShell的预处理HTTP方法。

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

现在,让我们把它改为GET每当CSV变量“方法”是“GET”

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


文章来源: How to parameterize http methods in Jmeter using CSV data config?