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?
There are three types of variables supported in robot framework − scalar, list and dictionary.
Robot Framework supports free named arguments, often also called free keyword arguments or kwargs, similarly as Python supports **kwargs. What this means is that a keyword can receive all arguments that use the named argument syntax (name=value) and do not match any arguments specified in the signature of the keyword.
This is a set of keywords or instruction to be executed after the start of test suite or test case execution. We will work on a project setup, where will use both setup and teardown. The opening and closing of browser are the common steps in test cases.
Try putting it inside the var name. i.e.
${N_groups-1}
If the variable is already a number, you can use:
${N_groups}= ${N_groups-1}
To do this you need to coerce it to a number (otherwise you'll get an error saying failed: TypeError: coercing to Unicode: need string or buffer, int found
), e.g.
*** Variables ***
${N_groups}= ${0} # ${} notation coerces value to a number
Alternatively, you can use Evaluate
like this, which works whether ${N_groups} has been coerced to a number or not:
${N_groups}= Evaluate ${N_groups} - 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With