Closed lyshchyk closed 9 months ago
Hello, thank you for asking for it!
Can you describe further the scenarios and configurations you use in your scripts? We strive to make the most used scenarios the simplest to use.
Sometimes we need to add pauses between transaction controllers or between parallel controllers to simulate user delay and in those cases we use flow control action sampler while building tests via jmeter GUI. I found a workaround in jmeter-dsl:
public DslSimpleController pauseSimpleController(Duration duration) {
return simpleController("Pause simple controller")
.children(constantTimer(duration))
}
We do it because it makes code more readable when you see pauses on the same level with main steps comparing to nested pauses in specific http request sampler and also limit scope of timer. So, for now, it's not a problem, but I think it would be great to have this out of the box. For other cases related to flow control action controller we are not blocked. Thank you!
If I may add my five cents too:
I would greatly appreciate if Flow control action and Constant timer could accept Strings.
The way For loop controller does. So I could refer to JMeter var as parameter.
E.g. a valid option now: forLoopController("${iterationNumber}")
Invalid options: constantTimer("${pauseTime}")
and flowControlAction("${pauseTime}")
.
Well, the latter does not exist (yet?)
A case came up where variable based parametrisation of a timer was required. Found no elegant solution to refer the existing variable. Could be me not searching hard enough though.
Sometimes we need to add pauses between transaction controllers or between parallel controllers to simulate user delay and in those cases we use flow control action sampler while building tests via jmeter GUI. I found a workaround in jmeter-dsl:
public DslSimpleController pauseSimpleController(Duration duration) { return simpleController("Pause simple controller") .children(constantTimer(duration)) }
We do it because it makes code more readable when you see pauses on the same level with main steps comparing to nested pauses in specific http request sampler and also limit scope of timer. So, for now, it's not a problem, but I think it would be great to have this out of the box. For other cases related to flow control action controller we are not blocked. Thank you!
This solution actually doesn't work, because timers are executed before samplers and there are no samplers in the provided solution. So I thinking that easiest way to be just Thread.sleep() or wait for flow control action implementation in jmeter dsl. Do you have any other solutions for that case, it would be great to see how we can do a workaround with current version on jmeter-dsl?
Well, Simple controller itself does not execute any logic, so the timer does not get applied. In terms of workarounds, I can suggest adding any runnable test element just inside your simple controller. Dummy Sampler, for instance.
public DslSimpleController pauseSimpleController(Duration duration) {
return simpleController("Pause simple controller").children(
dummySampler("Dummy sampler"),
constantTimer(duration)
)
}
Still we can further leverage that approach using just Dummy sampler on its own:
dummySampler("Pause").responseTime(duration)
which introduce a pause right where you put a Dummy Sampler, does not mess up with scopes and remains visible while working in GUI mode.
If you use just the dummySampler
you will need to also enable simulating pauses with simulateResponseTime(true)
.
I think that would be the simplest alternative with current version, or using jsr223Sampler( s -> Thread.sleep(X))
.
With the later you can even avoid the sample result from appearing in the reports by using something like jsr223Sampler( s -> { Thread.sleep(X); s.setIgnore(); })
We will consider adding the flow control action and allow using jmeter expressions and variables in constant timer for future releases.
Las week we released 1.25 which includes threadPause
element and allows to use JMeter expressions in constantTimer
.
I am closing this issue. If you have further questions we can re open it.
Awesome, thank you!
Hello, could you please implement flow control action? It's very useful for us and I think for other people too which do scenario based load testing.