Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMeter while loop does not detect EOF

I want to do "while" controller goes to the next controller when it reads EOF from CSV in JMeter. The while loop stops, but it iterates for 1 more time, I mean to say it does not need to iterate when it detects EOF. When I choose Stop thread on the EOF value as "True". The while loop stops and does not go for next loop.

I need to go to the next loop controller when the CSV file detects EOF without iterating one more loop.

Thanks in advance.

like image 760
Kamal Avatar asked Feb 08 '23 17:02

Kamal


1 Answers

From this post on BlazeMeter - Using the While Controller in JMeter, I found you can combine a While Controller with an If Controller to get the desired result.

The condition to control the iterations in both the while and if controllers is the following.

${__javaScript("${myVar}" != "<EOF>",)}

Note: Make sure to substitute the variable ${myVar}, with the variable from your csv file.

You need to use the If Controller to protect against an additional loop iteration because of when the while loop is actually evaluated.

All your samples are children of the If Controller.

The original post does a good job explaining it all.

like image 178
Martin Woolstenhulme Avatar answered Feb 15 '23 05:02

Martin Woolstenhulme