如何在jmeter中使用jsr 223预处理程序? [英] how to use jsr 223 preprocessor in jmeter?
问题描述
请有人帮我在Jmeter
中使用jsr223
预处理器和一些examples
进行脚本编写.
Someone please help me how to do scripting using jsr223
preprocessor in Jmeter
with some examples
.
任何获得相同tutorial
的最佳网站.
Any best site to get tutorial
for the same.
预先感谢
SIJO
推荐答案
例如:
- 首先,您需要选择一种脚本语言.根据 JMeter最佳做法,最好使用 HTTP请求,然后将
google.com
放入服务器名称或IP" " -
将JSR223预处理器添加为HTTP请求的子代,并将以下行放入脚本"区域:
- First of all you need to choose a scripting language. As per JMeter Best Practices it's better to use Groovy
- Add HTTP Request and put
google.com
into "Server Name or IP" Add JSR223 PreProcessor as a child of the HTTP Request and put the following line into "Script" area:
sampler.setDomain("example.com");
example.com
而不是google.com
google.com
.
example.com
instead of google.com
google.com
via View Results Tree listener. 因此,PreProcessors的目的是在请求之前做 ,以便使系统为请求或更改请求做好准备(例如,您具有要发送的动态参数数量或动态文件数量)与请求,并且不想对其进行硬编码).
So the purpose of PreProcessors is do something before request in order to make the system prepared for the request or change request somehow (for instance you have dynamic number of parameters or dynamic number of files to send with the request and don't want to hardcode it).
在上面的示例中,sampler
代表 HTTPSamplerProxy ,有关可用方法和字段,请参见JavaDoc.另请查看 Beanshell vs JSR223 vs Java JMeter脚本:关于性能的问题,您一直在等待!指南,以获取有关groovy引擎安装和脚本最佳实践的详细信息.
In above example sampler
stands for HTTPSamplerProxy, see JavaDoc for available methods and fields. Also check out Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For! guide for details on groovy engine installation and scripting best practices.
这篇关于如何在jmeter中使用jsr 223预处理程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!