kam*_*ame 6 variables robotframework
我只想减少最后一行中的变量N_groups.这是我的机器人文件:
Preconditions - Delete Groups But Not First
${N_groups} Setup Groups Count Groups
Log to console N_groups: ${N_groups}
: FOR ${INDEX} IN RANGE 1 20
\ Run Keyword If '${N_groups}' == '1' Exit For Loop
\ Setup Groups Delete Group ${group}
\ ${N_groups}= ${N_groups}-1
Run Code Online (Sandbox Code Playgroud)
我收到错误:
No keyword with name '${N_groups}-1' found.
我在这做错了什么?
如果变量已经是数字,则可以使用:
${N_groups}= ${N_groups-1}
为此,您需要将其强制为一个数字(否则您会得到一个错误提示failed: TypeError: coercing to Unicode: need string or buffer, int found),例如
*** Variables ***
${N_groups}= ${0} # ${} notation coerces value to a number
另外,您可以这样使用Evaluate,无论$ {N_groups}是否被强制为数字,该方法都可以使用:
${N_groups}= Evaluate ${N_groups} - 1
| 归档时间: |
|
| 查看次数: |
13964 次 |
| 最近记录: |