-3

I'm using the Robot Framework Ride to run a test. This is the test case structure:

if A>B:
   print 1
   print 2
   print 3
if C>D:
   print 4
   print 5

I didn't find a way to execute multiple commands below one if. I found one keyword Run Keyword if, but it can only execute one statement.

honk
  • 9,137
  • 11
  • 75
  • 83
JimWu
  • 5
  • 3
  • RIDE is just an IDE for editing robot framework tests. You question applies to robot framework, not RIDE. – Bryan Oakley Mar 28 '16 at 11:58
  • Possible duplicate of [How to write multiple conditions of if / else in robot framework](http://stackoverflow.com/questions/23863264/how-to-write-multiple-conditions-of-if-else-in-robot-framework) – shicky Mar 30 '16 at 15:56

1 Answers1

1

There are many robot framework keywords related to conditional steps. The most common one is Run keyword if. If you want to run multiple commands you can combine that with Run keywords.

For example:

*** Test cases ***
| Example
| | run keyword if | ${a} > ${B} | Run keywords
| | ... | log to console | 1
| | ... | AND | log to console | 2
| | ... | AND | log to console | 3

The BuiltIn library documents all of the keywords that come with robot framework.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • Hi Bryan Oakley, Thanks for your answer. I will do interface test with RF ride. So there are right and wrong parameter。when with right parameter, I want to get feedback and sure the content, if with wrong parameter, just prompt "wrong parameter". so help me how to resolve this case, thanks – JimWu Mar 29 '16 at 05:54
  • my test case as below: ******************************************************************************************create http context host=www.jucaicat.net:80 scheme=http get /jcc818/ContactUsInfo ${response_status} get response status should start with ${response_status} 200 ${body} get response body ${temp} get json value ${body} /weibo_desc ${title} get json value ${body} /title ${ret_phone_desc}= get json value ${body} /phone_desc should be equal ${ret_phone_desc} "400-050-1889 – JimWu Mar 29 '16 at 06:19
  • My test case can test right parameter, but if with wrong parameter, will prompt wrong. – JimWu Mar 29 '16 at 06:22