【问题标题】:Robot Framework - Keywords after [Return] line are also executingRobot Framework - [Return] 行之后的关键字也在执行
【发布时间】:2019-11-07 05:20:14
【问题描述】:

在 [Return] 语句之后编写的指令集正在执行。 Robot Framework 应该通过错误或者不应该考虑 [Return] 关键字之后写的关键字。如果我遗漏了什么,请给出解释。

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}

输出: 嘿嘿

【问题讨论】:

    标签: robotframework


    【解决方案1】:

    这就是机器人的工作方式。 [return] 只是定义了返回值,它不会导致关键字在被调用时返回。

    如果您想从函数中显式返回,您需要使用内置库中的关键字之一(例如Return from keywordReturn from keyword if 等)

    【讨论】:

    猜你喜欢
    • 2015-07-13
    • 2021-07-17
    • 2016-12-16
    • 2022-08-09
    • 1970-01-01
    • 2015-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多