如何使用CSV数据配置在Jmeter中参数化HTTP方法? [英] How to parameterize http methods in Jmeter using CSV data config?
本文介绍了如何使用CSV数据配置在Jmeter中参数化HTTP方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 CSV数据配置在Jmeter中设置 http方法?
How to parameterize http methods in Jmeter using CSV data config?
我做了什么:
created an HTTP Request Sampler (method POST)
,但是我需要从包含方法的csv文件中创建http请求采样器.
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.
推荐答案
您可以使用Beanshell预处理程序更改HTTP方法.
You can change the HTTP method using Beanshell Preprocessor.
为您现有的HTTP请求添加Beanshell预处理器.您的默认HTTP方法是POST.
Add a Beanshell preprocessor for your existing HTTP request. Your default HTTP method is POST.
现在,只要csv变量方法"为"GET",就将其更改为GET
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.
}
这篇关于如何使用CSV数据配置在Jmeter中参数化HTTP方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文