RobotFramework 的控制流语句:Run Keyword If
使用范围:有条件的执行KW
场景:1. 一般判断;2.多条件判断; 3. Test Suit 级别判断
1. 一般判断
1.1 单条件判断
数字对比: ${value} == 1 3 < ${value} < 18 ${value} < 0
字符对比: ‘${value}’ == 'singlequotes' "${value}" == "doublequotes"
布尔对比: ‘${value}’ == 'true' "${value}" == "false"
是否包含:${num} in @{value} and '${string}' in @{value} 【字符的要加单引号或者双引号】
列表对比:@{list1} == @{list2} @{list1}[1] == “@{list2}[2]” 【同上】
多个判断: A AND B AND C
多个执行语句: A and B and C
1.2 多条件判断
函数结构范例:
Run Keyword If 判断条件 其他关键字
... ELSE IF 判断条件 其他关键字
... ELSE 判断条件 其他关键字
2. Test Suit 级别的判断
Run Keyword If All Critical Tests Passed
Run Keyword If All Tests Passed
Run Keyword If Any Critical Tests Failed
Run Keyword If Any Tests Failed
Run Keyword If Test Failed
Run Keyword If Test Passed
Run Keyword If Timeout Occurred
网友评论