I'm trying to setup a simple while loop, but I keep getting this error:
'While' is a reserved keyword.
Robot Framework 4.1.3 (Python 3.8.10 on linux)
For sanity, I stripped everything out and created the following test with examples straight from the robotcorp docs (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 ${0}
WHILE ${x} < 3
${x}= Evaluate ${x} + 1
IF ${x} == 2
CONTINUE # Skip this iteration.
END
Log x = ${x} # x = 1, x = 3
END
The result:
$ 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
==============================================================================
Am I missing something or is this broken?
Yes, WHILE
is a reserved keyword, but not working on that version of Robot Framework, 4.1.3.
You probably are seeing the documentation of the future version, 5.0.
The first Beta version was just released today. See this post on the Forum:
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. (...)