Robotframework Robot框架,[Return]行之后的关键字也在执行

Robotframework Robot框架,[Return]行之后的关键字也在执行,robotframework,Robotframework,在执行[Return]语句之后写入的一组指令。机器人框架应该通过一个错误或不应该考虑的关键字后写[Re]关键字。如果我遗漏了什么,请解释一下 Settings Variables Keywords Custom Keyword [Return] hyyyy Return From Keyword hyyyy2222 Test Cases Test1 ${var_rt_ky2}= Custom Keyword Log To Console ${var_rt_ky2} 输出: hyyyy22

在执行[Return]语句之后写入的一组指令。机器人框架应该通过一个错误或不应该考虑的关键字后写[Re]关键字。如果我遗漏了什么,请解释一下

Settings

Variables

Keywords
Custom Keyword
[Return] hyyyy
Return From Keyword hyyyy2222

Test Cases
Test1
${var_rt_ky2}= Custom Keyword
Log To Console ${var_rt_ky2}
输出: hyyyy2222

在其他情况下

Settings

Variables

Keywords
Custom Keyword
Return From Keyword hyyyy2222
[Return] hyyyy

Test Cases
Test1
${var_rt_ky2}= Custom Keyword
Log To Console ${var_rt_ky2}
输出:
hyyyy

这就是机器人的工作原理
[return]
仅定义返回值,调用关键字时不会导致返回


如果您想从函数显式返回,您需要使用内置库中的一个关键字(例如,or等)

谢谢@Bryan-RobotFramework官员在社区论坛中回复-他们将在此时更新文档,因为我们在文档中没有此信息。