val = 12
:FOR ${i} IN RANGE ${val}
Run Keyword If condition1 or condition2 Call_Keyword ${val1} {val2}
Run Keyword If condition3 exit for loop
I am using this snippet test.robot file, but it says as
FOR loop contains no keywords.
I do not understand. what's wrong in this ?
You forgot to indent the keywords in the loop, e.g. to mark them as "the looped over block".
As explained in the user guide,
The keywords used in the for loop are on the following rows and they must be indented one cell to the right. When using the plain text format, the indented cells must be escaped with a backslash, ...
So in your case, as of 2017, it should be:
:FOR ${i} IN RANGE ${val}
\ Run Keyword If condition1 or condition2 Call_Keyword ${val1} {val2}
\ Run Keyword If condition3 exit for loop
In the newer version of the framework this syntax is deprecated, and uses a block ended with the END
keyword:
FOR ${i} IN RANGE ${val}
Run Keyword If condition1 or condition2 Call_Keyword ${val1} {val2}
Run Keyword If condition3 exit for loop
END