Forum Discussion

_ivanovich_'s avatar
Frequent Contributor
5 years ago

What is the correct use of IF ELSE statement with Groovy?


i want to know the correct use of if else statement in groovy.

I have a text file with the following content:


in table x:



a and b are saved in project properties tha i can retrieve in my test.


Can someone confirm me if the following statement is correct:

if( a=='N' || b=='N' ){
assert c == '0'
}else if ( a=='Y' || b=='Y' ){
assert c=='1'
}catch (AssertionError e){



if i put a==Y and b==Y in the first IF and put a==Y and b==Y

Will work correctly?

In my opinion it's not working, it asserts c==1 and we have a and b == N


5 Replies