I need to add a check condition for the search result page that, if a search result is found, the script should run further otherwise it should stop on the same step.
This is my Condition in if controller:
${__javaScript("${depdate}"=! null)}
Here depdate
is the regex parameter. If search results are found then its value will be null otherwise it will display content. It's a part of a json string.
I have put all further step in the if controller, but not success. Can anyone help me out of this? What is the reason that this is not working.
What is wrong here with what I am performing?
The reason is that your "${depdate}"
will never be null.
${depdate}
variable is set - it will be variable value${depdate}
variable is not set - it will be default value (which is ${depdate}
Demo:
So change your expression to be `${__javaScript(vars.get("depdate") != null)} and everything should start working fine.
See How to Use JMeter's 'IF' Controller and get Pie guide for more information on using IF conditions in your JMeter test.
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