Robotframework:Wait Until Keyword Successes的使用

Robotframework: The use of Wait Until Keyword Succeeds

我是 Robot 的新手,我想将 Wait Until Keyword Succeeds 与我的关键字一起使用,但它总是通过,即使它不应该通过。所以我想弄清楚控制 passed/failed 的关键字的 return 的值是多少。 举个例子: 我的关键词

def check_num(num):
    if num == 1:
        return True
    else:
        return False

Am calling:
Wait Until Keyword Succeeds      5 times      2 s       check num       0

我期待它 运行 5 次,暂停 2 秒并在最后失败,但它始终是绿色的。如果不是 True/False 应该使用,你能告诉我预期的是什么吗? 谢谢。

返回 False 不算失败。关键字只有在抛出异常时才会失败。

def check_num(num):
    if num != 1:
        raise Exception(f”{num} is not 1”)

有关详细信息,请参阅机器人框架用户指南中的 Reporting keyword status