smicyk / groovy-jmeter

A Groovy-based DSL for building and running JMeter test plans from command line and more.
Apache License 2.0
13 stars 1 forks source link

Load control #51

Closed AntonioSun closed 2 years ago

AntonioSun commented 2 years ago

https://github.com/smicyk/groovy-jmeter/blob/8e22a6230524704da27dae5aca5ebf686166ddf9/examples/commandline/script.groovy#L16

Questions

Thanks!

smicyk commented 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) {
}
AntonioSun commented 2 years ago

Ah, yes, I missed that. thx!

AntonioSun commented 2 years ago

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?

smicyk commented 2 years ago

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.

AntonioSun commented 2 years ago

Ah, gotcha. thx!

AntonioSun commented 2 years ago

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:

image

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.

smicyk commented 2 years ago

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.