robotframework的分支和循环

时间:2022-12-08 15:22:12

分支:

run keyword if  |  condition  |  do something

...        |      else if    | condition  | do something

...       |     else     | condition  | do something

循环1:

:FOR   | ${item}    |  IN  |  ${item1}  |  ${item2}  | ...

      |    do something

循环2:

:FOR   |  ${item}  | IN RANGE  | ${range1}  |  [  ${range2}]

     | do something

注意:${range2}是可选的,如果没有${range2},则范围设为  0~${range1}

循环3:

:FOR  |  ${item}  |  IN  |  @{arglist}

     |  do something

从变量列表中获取每个变量