You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Niraj <ni...@gmail.com> on 2019/05/06 07:18:57 UTC

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

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

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

Posted by Niraj <ni...@gmail.com>.
Found solution! Kindly ignore my email! Thanks

On Mon, May 6, 2019 at 12:48 PM Niraj <ni...@gmail.com> 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
>