问题描述
如何使用 jmeter 变量配置线程组加速时间,我尝试了线程数和加速时间.没有线程工作正常,但加速时间采用默认值 1,变量值不生效,感谢任何帮助
您不能在线程组设置中使用变量,因为线程组是在启动期间初始化的,在读取任何变量之前.
如果您需要配置线程数和/或加速周期,请使用
上述threads
和rampup
属性可以通过多种方式定义:
如果您在 命令行非 GUI 模式下运行 JMeter 你可以通过 -J 命令行键传递属性
jmeter -Jthreads=50 -Jrampup=30 -n -t/path/to/your/testplan.jmx
同样的方法适用于 GUI 模式,但是不建议使用 GUI 执行负载测试,因为它非常消耗资源并且可能会破坏您的测试.
您可以在 user.properties 文件(位于 JMeter 安装的/bin 文件夹中)中将这些属性定义为:
threads=50上升=30
重新启动后,JMeter 将选取属性,您将能够通过 __P() 函数引用它们,如上所述.
有关各种 JMeter 属性的综合信息和与他们合作的方式
how to configure the thread group ramp up time with a jmeter variable, I tried for both number of threads and ramp up time. No of threads is working fine, but ramp up time takes the default value 1 and the variable value doesn't take effect, Appreciate any help
You cannot use variables in Thread Group setting as Thread Groups are initialised during startup, before any variables are read.
If you need to make number of threads and/or ramp-up period configurable use __P() function like:
${__P(threads,)}
${__P(rampup,)}
Aforementioned threads
and rampup
properties can be defined in several ways:
If you run JMeter in command-line non-GUI mode you can pass the properties via -J command line key as
jmeter -Jthreads=50 -Jrampup=30 -n -t /path/to/your/testplan.jmx
The same approach will work for GUI mode, however it is not recommended to use GUI for load test execution as it is quite resource consuming and may ruin your test.
You can define these properties in user.properties file (located in /bin folder of your JMeter installation) as:
threads=50 rampup=30
After restart JMeter will pick the properties up and you will be able to refer them via __P() function as described above.
See Apache JMeter Properties Customization Guide for comprehensive information on various JMeter properties and ways of working with them
这篇关于将变量用于线程组加速时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!