1

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.

Ramya Rao
  • 86
  • 7
Praveen S
  • 11
  • 2

1 Answers1

0

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. 
}
vins
  • 15,030
  • 3
  • 36
  • 47