Robotframework 我们可以提供2个带有“的行动吗?”;运行关键字if";机器人框架的内置功能

Robotframework 我们可以提供2个带有“的行动吗?”;运行关键字if";机器人框架的内置功能,robotframework,Robotframework,这是示例代码,我必须执行。我必须使用带骑乘平台的robot框架为此执行两个操作,但它向我显示了错误,如预期的0个参数,得到1。我理解这个错误,但是如果我必须在这里自己执行两个操作,或者我必须在“检查帮助选项卡”的第一个关键字中添加另一个关键字“单击帮助按钮”,该怎么办呢?错误说明检查帮助选项卡不需要参数,但给出了一个参数。给定的参数是第二个关键字:单击帮助按钮 我知道有两种方法可以做到这一点,我推荐第一种: 1) 定义新关键字: Run Keyword If '${var1}'==

这是示例代码,我必须执行。我必须使用带骑乘平台的robot框架为此执行两个操作,但它向我显示了错误,如预期的0个参数,得到1。我理解这个错误,但是如果我必须在这里自己执行两个操作,或者我必须在“检查帮助选项卡”的第一个关键字中添加另一个关键字“单击帮助按钮”,该怎么办呢?

错误说明检查帮助选项卡不需要参数,但给出了一个参数。给定的参数是第二个关键字:单击帮助按钮

我知道有两种方法可以做到这一点,我推荐第一种:

1) 定义新关键字:

    Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Check for Help Tab  Click on Help button
然后像这样使用它:

Check Help Tab and Click Help Button
    Check for Help Tab
    Click on Help Button
或 (二)


错误表示“检查帮助”选项卡不需要参数,但给出了一个参数。给定的参数是第二个关键字:单击帮助按钮

我知道有两种方法可以做到这一点,我推荐第一种:

1) 定义新关键字:

    Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Check for Help Tab  Click on Help button
然后像这样使用它:

Check Help Tab and Click Help Button
    Check for Help Tab
    Click on Help Button
或 (二)

使用“运行关键字” 可以运行关键字,此时可以运行多个关键字

例如:

Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Check Help Tab 
Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Click Help button
*** Test cases ***
Example
    run keyword if  1 == 1  run keywords
    ...  log  this is a normal log
    ...  AND  log  this is a warning  WARN
    ...  AND  log to console  this is a log to the console
使用自定义关键字 您的另一个选项是创建一个自定义关键字,该关键字可以执行您需要它执行的所有操作,并将该关键字称为:

例如:

Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Check Help Tab 
Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Click Help button
*** Test cases ***
Example
    run keyword if  1 == 1  run keywords
    ...  log  this is a normal log
    ...  AND  log  this is a warning  WARN
    ...  AND  log to console  this is a log to the console
使用“运行关键字” 可以运行关键字,此时可以运行多个关键字

例如:

Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Check Help Tab 
Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Click Help button
*** Test cases ***
Example
    run keyword if  1 == 1  run keywords
    ...  log  this is a normal log
    ...  AND  log  this is a warning  WARN
    ...  AND  log to console  this is a log to the console
使用自定义关键字 您的另一个选项是创建一个自定义关键字,该关键字可以执行您需要它执行的所有操作,并将该关键字称为:

例如:

Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Check Help Tab 
Run Keyword If    '${var1}'=='@{var2}[1]'    Run Keyword And Return Status    Click Help button
*** Test cases ***
Example
    run keyword if  1 == 1  run keywords
    ...  log  this is a normal log
    ...  AND  log  this is a warning  WARN
    ...  AND  log to console  this is a log to the console

谢谢你的回复。我将以Bryan强调的相同方式实现,这可以使用标准关键字实现。感谢您的回复。我将以Bryan强调的相同方式实施,这可以使用标准关键字。感谢Bryan的建议。感谢Bryan的建议。