Closed AntonioSun closed 2 years ago
Hi,
the users and duration are created by groovy based on your command line input -Vusers=1 -Vduration=10. So you can create your own variable just by -Vmyvariablename=1 and then use it in the script as:
groupt(users: myvariablename) {
}
Ah, yes, I missed that. thx!
Also,
To control the load, JMeter also has/need a third parameter --how long the script should run, or how many iterations. When such info is missing, how the user-load is exactly happening when groovy-jmeter scripts are being run?
how about this?
I'm not sure if this suites you but group keyword has following structure:
group (
users: integer (1) [1..9223372036854775807]
rampUp: integer (1) [1..9223372036854775807]
delayedStart: boolean
scheduler: boolean
delay: integer [0..9223372036854775807]
duration: integer [0..9223372036854775807]
loops: integer (1) [1..9223372036854775807]
forever: boolean
) {
}
So to setup so time periods you can use users and rampUp properties. Or you can use scheduler, delay and duration to has more specific start time and end time.
You should refer to https://jmeter.apache.org/usermanual/component_reference.html#Thread_Group for more details. Please remember that most of the time properties on Apache JMeter GUI is mapped one to one to the keywords in the script.
You can also check the project wiki to view all keywords and parameters.
Ah, gotcha. thx!
Or you can use scheduler, delay and duration to has more specific start time and end time.
I think the delay and duration might have somehow been switched. This is my source:
group(name: 'Thread Group',
users: '${c_lt_users}', rampUp: '${c_lt_ramp}',
loops: '${c_lt_loops}', duration: 12000) {
and this is what I get from --jmx-out
:
BTW, while you're at it, I think the default name for Thread Group is "Thread Group", if you don't rename it after creating it within JMeter. I think it'd better to use this as the default name, which will be acceptable to a broader audiences.
Fixed with #96
Regarding 'Thread Group' name. I made such convention to use User instead of Thread in the parameters names and in general when naming this concept. I think it makes more sense to use that name.
https://github.com/smicyk/groovy-jmeter/blob/8e22a6230524704da27dae5aca5ebf686166ddf9/examples/commandline/script.groovy#L16
Questions
How are the
users
duration
variables passed? I see the calling script to begroovy script.groovy --jmx-out script.jmx -Vvar1=value1 -Vvar2=value2 -Vusers=1 -Vduration=10
but I haven't find where theusers
duration
are specified.To control the load, JMeter also has/need a third parameter --how long the script should run, or how many iterations. When such info is missing, how the user-load is exactly happening when groovy-jmeter scripts are being run?
Thanks!