'how to write 2 conditions in single while controller?

i have used below code in while controller but not working in single iteration. these 2 conditions used for text checking

${__javaScript("${textcheck1}".indexOf("Message") == -1,)} 
&& 
${__javaScript("${textcheck2}".indexOf("Message1") == -1,)}

plz help me on that.how to write both condition in single while controller? i have tried multiple ways but not working ..



Solution 1:[1]

You need to put both conditions into single __javaScript() function like

${__javaScript(("${textcheck1}".indexOf("Message") == -1 && ("${textcheck1}".indexOf("Message1") == -1,)}

See Using the While Controller in JMeter article for more details.

Also as per __javaScript() function documentation:

javaScript is not the best scripting language for performances in JMeter. If your plan requires a high number of threads it is advised to use __jexl3 or __groovy functions.

so it worth considering migrating.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T