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

[Feature] Allow loops: -1 for infinite loop #123

Closed AntonioSun closed 6 months ago

AntonioSun commented 7 months ago

I like to spell out all the group requied parameters, like this:

    group(name: 'Thread Group', delay: c_lt_delay, delayedStart: true,
      users: c_lt_users, rampUp: c_lt_ramp, keepUser: false,
      loops: c_lt_loops, duration: c_lt_duration, scheduler: true) {

However, most often I need to flip between infinite loop and timed test back and force. Allowing loops: -1 as indication of infinite loop will make the flipping much easer than changing the above code, as I would like to be able to change the behaviour of the load by just tweaking those parameters.

Currently it'll just error out:

net.simonix.dsl.jmeter.model.ValidationException: The property 'loops' has invalid value. The value should be from range 1..9223372036854775807?

Whereas if you put -1 in jmeter as the loop value, jmeter will make it an infinite loop right afterwards.

PS. Maybe the algorithm should be <=0, the reason I like negative valuses instead of 0 more is because it'll be much siimple to add and remove the - sign, than changing the value to 0, and having difficulties to remember what value it was when changing it back.

AntonioSun commented 7 months ago

Actually, I don't know how to enable infinite loop as of now, because even if I commented out the loop: parameter, it'll still use 1 as the default value, and if I provide a value, then the test will become loop controlled, not time controlled. I.e., currently I don't know how to enable control by run time.

smicyk commented 6 months ago

Hi, to make user group to run forever you need to add forever: true to the group parameters.

I will take a look at the possibility of putting -1 as another indication of making it forever.

smicyk commented 6 months ago

The fix was added to this issue and from new version it will have possibility to set the -1 to indicate infinite. You can still override this with forever but in your case probably it will not be needed.