Reputation: 397
I currently have a problem with While Controller in JMeter I have a While Controller with many steps inside it, the final step has a BeanShell Assertion with something like this
${__setProperty(sessionUID_global,${sessionUID})};
I'm trying to put a condition for While Controller like this:
${__javaScript(vars.get("sessionUID_global") == null)}
But, It's not working Could anyone help me to stop the while controller with a condition when sessionUID_global has a value?
Thank you
Upvotes: 0
Views: 942
Reputation: 168072
You need to change this:
${__javaScript(vars.get("sessionUID_global") == null)}
to this:
${__javaScript(props.get("sessionUID_global") == null)}
Going forward:
Consider switching from the Beanshell Assertion to JSR223 Assertion with the following code:
props.put('sessionUID_global', vars.get('sessionUID'))
Consider migrating While Controller's condition to __groovy() function like:
${__groovy(props.get("sessionUID_global") == null)}
As starting from JMeter 3.1 you should be using JSR223 Test Elements and __groovy() function for any form of scripting
Upvotes: 1
Reputation: 77
JMeter variables are never null. To check the condition, you can use for example:
${__javaScript(vars.get("sessionUID_global")>0)}
Upvotes: 1