Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I am trying to seperate the numbers to odd and even and then pass to to the url path using variable in jmeter

I have a get request from where I am taking all the id values , using json extractor I have extracted and named it id and used match number as -1

Now I want to pass this id variable into a post url paths

And this post requests are set inside a for each controller to run for required no of iterations

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I have given for each controller values as
Input variable : id
Start index : 0
End index : ${id_matchNr}
Output var name : outid

Paths arelike

Post Path 1: https://demo.qwe.com/blue${outid}

Post Path 2:
https://demo.qwe.com/blue${outid}

I want to pass only even id numbers to path 1 and odd id numbers to path two

So I have used if controller and gave expression as
${outid}%2==0 to first path
And ${outid}%2!=0 to other if controller and placed the path 2 request
And checked the interpret condition

These two rqsts are in for each controller.

When I run the script I am getting a blank output for the post rqsts.

Can you please help me out

>Solution :

The function or variable you put in the If Controller must evaluate to true, only this way the If Controller will run its children. In your case you’re providing just a string.

You need to wrap it into i.e. __jexl3() function like:

${__jexl3(${outid}%2==0,)}

this way it should work as expected.

More information: 6 Tips for JMeter If Controller Usage

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading