如何 运行 在 Robot Framework 中的多个变量上使用相同的关键字

How to run same keyword over multiple variables in Robot Framework

我有以下例子:

Keyword A
[Arguments]  ${variablesA}  ${variablesB}
     Mouse Over  ${variablesA}
     Mouse Over  ${variablesB}
Keyword B
[Arguments]  ${variablesA}  ${variablesB}  ${variablesC}
     Mouse Over  ${variablesA}
     Mouse Over  ${variablesB}
     Mouse Over  ${variablesC}

看上面的例子,我只想创建一个关键字,它可以处理任意数量的变量 运行 对 Mouse Over

我看到我们可以将 FORCreate List 结合使用,但我认为在这种方法中我们需要从一开始就确定项目的数量?

您可以使用可变数量的参数:

Keyword C
    [Arguments]    @{arguments}
    :FOR    ${argument}    IN    @{arguments}
    \    Mouse Over    ${argument}