1
votes

How to parameterize http methods in Jmeter using CSV data config?

What I did: created an HTTP Request Sampler (method POST), but I need to create http request sampler from a csv file including method also.

1

1 Answers

0
votes

You can change the HTTP method using Beanshell Preprocessor.

Add a Beanshell preprocessor for your existing HTTP request. Your default HTTP method is POST.

Now lets change it to GET whenever the csv variable 'method' is 'GET'

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