我们是否可以在 IF 部分中执行一段关键字,并且可以选择与 ELSE/ELSE IF 部分一起执行?它可以像下面这样:
Run keyword If ${x} == "Simple"
Keyword1 [arg1] [arg2]
Keyword2 [arg3]
Keyword3 [arg4] [arg5]
ELSE
Keyword4 [arg6]
END IF
Run Code Online (Sandbox Code Playgroud)
运行关键字 如果不支持调用多个关键字,但您可以运行关键字运行关键字,这将允许您运行多个关键字。
例如:
*** 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
Run Code Online (Sandbox Code Playgroud)
当然,您始终可以创建其他关键字:
*** 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
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13050 次 |
最近记录: |