How to subtract the structure "Number in a robot"
How to subtract a number in Robot Framework What is the command for it ... for example, I get the score. i want to subtract -1 and display with a different value.
If your variable contains an actual number, you can use the extended variable syntax . For example, this test will pass:
*** Variables ***
| ${count} | ${99} | # using ${} syntax coerces value to number
*** Test cases ***
| Example
| | Should be equal as numbers | ${count-1} | 98
You can also use the Evaluate keyword to create a python expression. For example:
*** Variables ***
| ${count} | 99
*** Test cases ***
| Example
| | ${count}= | Evaluate | ${count} - 1
| | Should be equal as numbers | ${count} | 98
Note: using Evaluate will work whether it is a ${count}
number or a string representation of a number.
You can use the Evaluate keyword:
*** Test Cases ***
Stackoverflow
${x} = Set Variable 1
${y} = Evaluate ${x} - 1
An expression like this should work:
$ {token_expire_time} = Rate $ {token_generate_time} - $ {expires_in}
If for some reason the conversion with $ {} doesn't seem to work, then feel free to use:
Convert to integer keyword
or
Convert to numeric