如果在Robot Framework中否则

Natchaya TingTang

我想通过使用else if从关键字获取价值。

例:

String text = ""  
If variable > 5
   text = "one";
else if variable <5
   text = "two";
else
   text = "three";

在机器人框架中

我使用代码

${txt}    Set Variable
${txt}=    Run Keyword If    ${length} > 5    Some Keyword
\    ELSE IF    ${length} < 5    Some Keyword
\    ELSE    Some Keyword
Log       ${txt}

错误!

In Keyword ELSE IF  ;  Keyword name cannot be empty
Minh Nguyen-Phuong-Hoang

只需在ELSE IF关键字之前的第一个单元格中添加三个点(...)

${txt}    Set Variable
${txt}=    Run Keyword If    ${lenght} > 5    Some Keyword
...    ELSE IF    ${lenght} < 5    Some Keyword
...    ELSE    Some Keyword
Log       ${txt}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章