Need Help on grovvy script for OR (||) condition

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Need Help on grovvy script for OR (||) condition

niraj
Hi,

Can someone please help me with a groovy script?

I have added one If Controller and added below condition.

${__groovy(vars.get('testName').contains("test1"),)}

This works fine for me when testName is test1. Requests below IF
controllers gets executed.

But when I want OR(||) or And (&&) Condition in same grovvy script, JMeter


${__groovy(vars.get('testName').contains("test2")||(vars.get('testName').contains("test3"),)}
I am getting below error
org.apache.jmeter.functions.InvalidVariableException: Expected } after
__groovy function call in
${__groovy((vars.get('testName').contains("GetUnderlyingDetails")||(vars.get('testName').contains("G

Kindly help to get groovy script with OR condition.


Thanks in advance!
-Niraj
Reply | Threaded
Open this post in threaded view
|

Re: Need Help on grovvy script for OR (||) condition

niraj
Found solution! Kindly ignore my email! Thanks

On Mon, May 6, 2019 at 12:48 PM Niraj <[hidden email]> wrote:

> Hi,
>
> Can someone please help me with a groovy script?
>
> I have added one If Controller and added below condition.
>
> ${__groovy(vars.get('testName').contains("test1"),)}
>
> This works fine for me when testName is test1. Requests below IF
> controllers gets executed.
>
> But when I want OR(||) or And (&&) Condition in same grovvy script,
> JMeter
>
>
> ${__groovy(vars.get('testName').contains("test2")||(vars.get('testName').contains("test3"),)}
> I am getting below error
> org.apache.jmeter.functions.InvalidVariableException: Expected } after
> __groovy function call in
> ${__groovy((vars.get('testName').contains("GetUnderlyingDetails")||(vars.get('testName').contains("G
>
> Kindly help to get groovy script with OR condition.
>
>
> Thanks in advance!
> -Niraj
>