为什么机器人框架返回 'While' 是保留关键字

Why is robot framework returning 'While' is a reserved keyword

我正在尝试设置一个简单的 while 循环,但我一直收到此错误:

'While' is a reserved keyword.

机器人框架 4.1.3(Python 3.8.10 on linux)

为了理智,我删除了所有内容并使用直接来自 robotcorp 文档 (https://robocorp.com/docs/languages-and-frameworks/robot-framework/while-loops)

的示例创建了以下测试

While.robot

*** Settings ***

*** Variables ***
@{ROBOTS}=        Bender    Johnny5    Terminator    Robocop

*** Keywords ***

*** Test Cases ***

Loop Over A List Of Items And Log Each Of Them
    FOR    ${robot}    IN    @{ROBOTS}
        Log    ${robot}
    END

Testing While Loop
    ${x}=    Set Variable    [=11=]
    WHILE    ${x} < 3
        ${x}=    Evaluate    ${x} + 1
        IF    ${x} == 2
            CONTINUE    #  Skip this iteration.
        END
        Log    x = ${x}    # x = 1, x = 3
    END

结果:

$ robot tests/While.robot 
==============================================================================
While                                                                         
==============================================================================
Loop Over A List Of Items And Log Each Of Them                        | PASS |
------------------------------------------------------------------------------
Testing While Loop                                                    | FAIL |
'While' is a reserved keyword.
------------------------------------------------------------------------------
While                                                                 | FAIL |
2 tests, 1 passed, 1 failed
==============================================================================

我是不是遗漏了什么或者这个坏了?

是的,WHILE 是保留关键字,但不适用于该版本的 Robot Framework,4.1.3。

您可能正在查看未来版本 5.0 的文档。

第一个 Beta 版本 今天 刚刚发布。在论坛上查看 this post

pekkaklarck Pekka Klärck

Robot Framework 5.0 is a big new major release with lot of interesting new features such as TRY/EXCEPT, WHILE, inline IF, RETURN, BREAK and CONTINUE syntax, support for custom argument conversion in libraries and various enhancements to xUnit outputs. Robot Framework 5.0 only works with Python 3.6 or newer. Robot Framework 5.0 beta 1 is the second preview release and contains the majority of the planned new features. For more details see the full release notes 4. (...)