JMeter "if controller" with parameters?

Ben Flynn picture Ben Flynn · Apr 18, 2011 · Viewed 94.3k times · Source

I was reading the JMeter documentation and came across this info box about "If Controllers":

No variables are made available to the script when the condition is interpreted as Javascript. If you need access to such variables, then select "Interpret Condition as Variable Expression?" and use a __javaScript() function call. You can then use the objects "vars", "log", "ctx" etc. in the script.

I don't quite follow this. Does this mean if I want access to a "User Defined Parameter" then I can access it only by writing some JavaScript? The example that follows this box then refers to "${COUNT}"

Could someone clarify the usage of the If Controller, maybe with an example or two?

Answer

jameshfisher picture jameshfisher · Feb 12, 2014

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

"${my_variable}"=="foo"