vlatko606
vlatko606

Reputation: 1149

Jmeter - How to loop until certain integer - 'While contoller' nested in the 'Loop contoller'

My Architecture is like this:

enter image description here

From JsonPath I extract all the programID's like:

enter image description here

When Executed is like this:

enter image description here

The question is: How to tell the while controller is loop until programId 80?

What I tried is:

enter image description here

Any help is appreciated

Upvotes: 0

Views: 400

Answers (2)

vlatko606
vlatko606

Reputation: 1149

Thanks Dmitri T for your direction. The honey for me in this case was the alteration the JSON path expression to:

$..pageItems[?(@.programId>80)].programId

Like this I was able to filter all the programId higher than 80.

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 167992

I think correct __groovy() function would be something like:

${__groovy((vars.get('programId_' + vars.get('Counter')) as int) > 80,)}

in general I wouldn't recommend inlining JMeter Functions or Variables into Groovy scripts as it's bad for performance and may cause issues, go for code-based equivalents instead, in the above example vars stands for JMeterVariables class instance, see Top 8 JMeter Java Classes You Should Be Using with Groovy

A better option would be amending your JSONPath query to return IDs which are above 80, see Filter Operators

Upvotes: 1

Related Questions