Decrement or increment a variable in the robot framework

kame picture kame · Jan 28, 2016 · Viewed 19.8k times · Source

I just want to decrement the variable N_groups in the last line. This is my robot file:

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

I get the error:

No keyword with name '${N_groups}-1' found.

What I am doing wrong here?

Answer

shicky picture shicky · Jan 28, 2016

Try putting it inside the var name. i.e.

${N_groups-1}