I am setting my Jmeter variable using this using beanshell assertion:
${__setProperty(id_${__threadNum},${id},)}
And using this in another request like this:
${__P(id_${__threadNum},)}
and running the requests like this
However I want to run the loop count instead of the thread. So that i can run the request one by one. How can i change it to so it is loopNum instead of the thread
Can i use this below when i want to use the loop instead of the thread??
I am setting my Jmeter variable using this:
${__setProperty(id_${__iterationNum},${id},)}
And using this in another request like this:
${__P(id_${__iterationNum},)}
For getting the current iteration (1st loop - 1
, 2nd loop - 2
, etc.):
props.put("id_" + vars.getIteration(), vars.get("id"));
For getting all iterations (each time it will return 10
)
props.put("id_" + ctx.getThreadGroup().getSamplerController().getProperty("LoopController.loops"), vars.get("id"));
Few more hints:
props
stand for JMeter Properties, vars
- for JMeter Variables, etc.), see Top 8 JMeter Java Classes You Should Be Using with Groovy article for more details.