问题
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:
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.
}
来源:https://stackoverflow.com/questions/31729223/how-to-parameterize-http-methods-in-jmeter-using-csv-data-config