mercredi 3 octobre 2018

Jmeter: unable to use multiple conditional statement in If Controller

In Jmeter v4.0 r 1823414 I can use If Controller only with single statement, but not with multiple. Example of using multiple statements I have taken from here and it was suggested to use

${__javaScript("${responsecode}"=="404")} && ${__javaScript("${responseMessage}" == "Not Found")}

I have also checked blazemeter tutorial page, but it says nothing about multiple conditional statements inside If Controller.

Example of my Test Plan is below

enter image description here

In my Debug Sampler I can see following

enter image description here

At some place in the Test Plan I put IF Controller to check that both variables are equal to not_found...

${__javaScript(vars.get('manual_bug')=='not_found')} && ${__javaScript(vars.get('integration_bug')=='not_found')}

...so all the subsequent actions are executed. However, this IF Controller either never gets executed or always return FALSE. Not sure what's happening with it.

Before blaming me that I didn't do enough research and rushed to ask a question on SO, I will provide below samples of what I've already tried and that didn't help:

  • With double quotes around variables

    ${__javaScript(vars.get("manual_bug")=="not_found")} && ${__javaScript(vars.get("integration_bug")=="not_found")}

  • With additional space between equal sign

${__javaScript(vars.get('manual_bug') == 'not_found')} && ${__javaScript(vars.get('integration_bug') == 'not_found')}

  • Avoid using vars.get

${__javaScript(${manual_bug} == 'not_found')} && ${__javaScript(${integration_bug} == 'not_found')}

  • Using double quotes without vars.get

    ${__javaScript(${manual_bug} == "not_found")} && ${__javaScript(${integration_bug} == "not_found")}

My log file looks completely fine, no errors

enter image description here

enter image description here

Please advise if someone was able to execute multiple conditional statements in the Jmeter tool? Thanks!

Aucun commentaire:

Enregistrer un commentaire