Search code examples
jmeterjmeter-pluginsjmeter-5.0jmeter-4.0jmeter-3.2

if controller not working when I use ${status} == true


I am having a hard time having jemeter working with my if condition

enter image description here

As you see the above I am checking is status variable which I created in earlier car is true and it is true so I expect this if gets executed but it does not. However as soon as I change it to

enter image description here

It works fine.

I need these kind of check for sure(for a case like ${status} == false)

Am I missing anything?

** Update **

when I disable interpret regx I can see it works enter image description here


Solution

  • This is expected behaviour.

    In If Controller When you uncheck "Interpret condition as Variable Expression", Javascript is used to evaluate :

    ${status} == true

    So it works, but it hurts badly performances.

    So instead and as per reference documentation:

    Option 2 : Use a function (${__jexl3()} is advised) to evaluate an expression that must return true or false

    So keep "Interpret condition as Variable Expression" checked and use __jexl3 function:

    ${__jexl3(${status} == true,)}

    This give you:

    Good configuration