问题
I have wrote a JMeter test and I want to run it in Command Line with some parameters, let's say ThreadNumber.
How do I read it in JSR223/BeanShell?
回答1:
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.
Use props
to get properry in JSR223/BeanShell
props.get("threadNum")
- Note you may set ramp up same as thread number property
Start with Ramp-up = number of threads and adjust up or down as needed.
来源:https://stackoverflow.com/questions/50222816/how-to-read-jmeter-test-cmd-line-parameters-from-jsr223-beanshell