JMeter "if controller" with parameters?

UNCHECK the CHECKBOX "Interpret condition as variable expression"

I wasted a couple of hours without unchecking this checkbox. It worked with and without semicolon(;) at the end of the statement. Make sure that you have set the User-Defined Variables before calling the if controller.

All the following variations worked for me in Jakarta Jmeter 1.5

  • ${__javaScript("${HOMEPAGE}"=="Y")}
  • ${__javaScript("${HOMEPAGE}"=="Y")};
  • "${HOMEPAGE}"=="Y"
  • "${HOMEPAGE}"=="Y";

You can simply use something like

${my_variable}=='1'

Sometimes JMeter documentation can be confusing :)

Edit 27 september 2017:

The answer here works but has a very bad performance impact when number of threads exceeds 40.

See below for correct and most performing answer:

  • https://stackoverflow.com/a/46976447/460802

See:

  • https://bz.apache.org/bugzilla/show_bug.cgi?id=61675

All these answers are wrong! You need to put the variable reference in quotes, like so:

"${my_variable}"=="foo"

Tags:

Jmeter