0
votes

I am trying to evaluate below expression in Robot framework

Run Keyword If '${buttondisplayed}' == 'PASS' and '${ReturnedInfo}' == ' PASS', Some Keyword,

else if, '${buttondisplayed}' == 'PASS' and '${ReturnedInfo}' == 'FAIL', Some Keyword ,

else if, '${buttondisplayed}' == 'FAIL' and '${ReturnedInfo}' == 'PASS', Some Keyword,

else, Some Keyword

Where the value of both ${buttondisplayed} and ${ReturnedInfo} = FAIL.

Based on above condition, else part mentioned, in the end, should be executed however in Log output I am getting the following result

Documentation:
Runs the given keyword with the given arguments, if the condition is true. Start / End / Elapsed: 20170806 11:15:14.448 / 20170806 11:15:14.448 / 00:00:00.000

So basically none of the conditions is executed here. Could anyone please indicate what is wrong here in this expression?

2

2 Answers

2
votes

There are at least four problems with the code you've posted:

  1. there's only one space after the first "if"
  2. "else if" is lowercase. It must be all uppercase (ELSE IF)
  3. you have commas in your code. robot syntax doesn't support commas as field separators
  4. your code seems to span multiple lines but you aren't using the robot line continuation characters ...
1
votes
Run Keyword If   '${buttondisplayed}'=='PASS' and '${ReturnedInfo}'=='PASS' Some Keyword
... ELSE IF  '${buttondisplayed}'=='PASS' and '${ReturnedInfo}'=='FAIL' Some Keyword
... ELSE IF  '${buttondisplayed}'=='FAIL' and '${ReturnedInfo}'=='PASS' Some Keyword
... ELSE Some Keyword