I have to simulate a scenario where I want 50% to use one http request and the rest for another request. I tried using the IF controller to split by threadNumber i.e. send the odd thread numbers to one side and even to another. I tried using the condition in IF controller in Jmeter as
${threadNum}' % 2 == '0'
and '${threadNum}' %2 != '0'
I tried with around 10 users and I always see them going only into the odd queue i.e. ${threadNum}' % 2 == '0' is never satisfied. Am i doing it the right way?
Lots of problems here:
The JMeter function is __threadNum You lost the underscores somewhere. Ref
What data type do you expect ${__threadNum} to return? If it is a string, why would you do arithmetic (%2) on a string. If it is an int, why are you comparing it to a char ('0')?
As an aside, do not compare strings in java using the == operator. See here.
That being said, if you want half the threads to use a second sampler, why not setup two thread groups with half the number of threads each, with one of the two http requests under the two thread groups?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With