SAUMYA TIWARI
SAUMYA TIWARI

Reputation: 21

How to get total loop count in JMeter using Groovy

I want to get total number of loop count in assertions. Let I have set loop count 6, then I should get total loop count value 6

int totalLoopCount = vars.getIteration();

Its giving me running loop count value i.e 1 2 3 4 5 6

I want total loop count value 6. Any help would be appreciated. enter image description here

Upvotes: 2

Views: 1805

Answers (1)

Dmitri T
Dmitri T

Reputation: 168092

You can do this like:

def loops = ctx.getThreadGroup().getSamplerController().getProperty('LoopController.loops')

Demo:

JMeter Get Thread Group Loops Number

ctx is a shorthand for JMeterContextService, see the JavaDoc for all available methods and fields.

You might also be interested in The Groovy Templates Cheat Sheet for JMeter

Upvotes: 1

Related Questions