robotframework ---- set variable if
1. 简介
最常用的形式是:
${var} set variable 判断条件 a b
如果条件为真,变量${var}的值设为a, 否则设为b。
另一种使用形式:
${var} set variable 判断条件1 a
... 判断条件2 b
... c
如果条件1为真,变量${var}的值设为a, 否则判断条件2,若为真变量值设为b,否则设为c。
2. 使用示例
*** Test Cases ***
Test_001
${num} set variable 0
${result} set variable if ${num}<0 a b
log to console ${result}
${num2} set variable 5
${result2} set variable if ${num2}<0 less than 0
... ${num2}<10 less than 10
... greater than 10
log to console ${result2}
执行结果: