Can we have a block of keywords to be executed within a IF part and optionally with ELSE/ELSE IF part ?. It can be like something below:
Run keyword If ${x} == "Simple"
Keyword1 [arg1] [arg2]
Keyword2 [arg3]
Keyword3 [arg4] [arg5]
ELSE
Keyword4 [arg6]
END IF
Run Keyword If doesn't support calling multiple keywords, but you can run the keyword Run Keywords which will let you run multiple keywords.
For example:
*** Test Cases ***
| Example of running multiple keywords with "Run keyword if" and "Run keywords"
| | ${x}= | Set variable | Simple
| | Run keyword if | "${x}" == "Simple" | Run keywords
| | ... | log to console | this is keyword one
| | ... | AND | log to console | this is keyword two
| | ... | ELSE
| | ... | log to console | this is keyword three
Of course, you can always just create additional keywords:
*** Keywords ***
| Handle the simple case
| | log to console | this is keyword one
| | log to console | this is keyword two
| Handle the complex case
| | log to console | this is keyword three
*** Test Cases ***
| Example of using separate keywords for "Run keyword if"
| | ${x}= | Set variable | Simple
| | Run keyword if | "${x}" == "Simple"
| | ... | Handle the simple case
| | ... | ELSE
| | ... | Handle the complex case
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With