如何从JSR223/Beanshell读取JMeter测试Cmd行参数 [英] How to read JMeter Test Cmd Line Parameters from JSR223/Beanshell
问题描述
我已经编写了一个JMeter测试,我想在命令行中使用一些参数(例如ThreadNumber)运行它.
I have wrote a JMeter test and I want to run it in Command Line with some parameters, let's say ThreadNumber.
我如何在JSR223/BeanShell中阅读它?
How do I read it in JSR223/BeanShell?
推荐答案
使用-J
在命令行中发送属性,以添加新属性
Send property in command line using -J
which adds new property
-JthreadNum=100
Inside Thread Group use the value using __P
function in Number of Users(threads) field
${__P(threadNum)}
简化的属性函数,旨在与命令行上定义的属性一起使用.
simplified property function which is intended for use with properties defined on the command line.
使用props
在JSR223/BeanShell中获取属性
Use props
to get properry in JSR223/BeanShell
props.get("threadNum")
- 请注意,您可以将设置与线程号属性相同
以Ramp-up =线程数开始,并根据需要向上或向下调整.
Start with Ramp-up = number of threads and adjust up or down as needed.
这篇关于如何从JSR223/Beanshell读取JMeter测试Cmd行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!