一、RF中断言方式
- title should be(断言title与预期指定的title内容相等)
Open Browser https://www.baidu.com/ gc
Title Should Be 百度一下,你就知道 页面错误
- should be equal (断言某个字符串与预期指定的字符串相等)
Open Browser https://www.baidu.com/ gc
${title} Get Title
Should Be Equal ${title} 百度一下,你就知道 页面错误
- should not be equal (断言某个字符串与预期指定的字符串不相等)
Open Browser https://www.baidu.com/ gc
${title} Get Title
Should Not Be Equal ${title} 百度一下 页面错误
- Should Match (断言某个字符串与预期指定的字符串相匹配)
- 解释:如下断言${var}以zheng匹配相等,如果不匹配则抛出msg:${var}与zheng不匹配
${var} Set Variable zhengying
Should Match ${var} zheng ${var}与zheng不匹配
- Should Not Match (断言某个字符串与预期指定的字符串不匹配)
- 解释:如下断言${var}以zheng不匹配相等,如果匹配则抛出msg:${var}与zheng匹配
${var} Set Variable zhengying
Should Not Match ${var} zheng ${var}与zheng匹配
- Should Contain (包含某值)
- 解释 :如下断言${var}中包含zheng,如果不包含则抛出msg:${var}不包含zheng
${var} Set Variable zhengying
Should Contain ${var} zheng ${var}不包含zheng
- should not contain (不包含某值)
- 解释:如下断言${var}中不包含zheng1,如果包含则抛出msg:${var}包含zheng1
${var} Set Variable zhengying
Should Not Contain ${var} zheng1 ${var}包含zheng1
- should contain x times (包含某值X次)
- 解释:如下断言${var}中包含字符串 n 该元素2次,如果不成立则抛出msg:n出现次数不对
${var} Set Variable zhengying
should contain x times ${var} n 2 n出现次数不对
- Should Start With (断言某个字符串是以指定值开始)
- 解释:如下断言${var}以zheng开始,如果不是则抛出msg:${var}不是以zheng开始
${var} Set Variable zhengying
Should Start With ${var} zheng ${var}不是以zheng开始
- Should not Start With (断言某个字符串不是以指定值开始)
- 解释:如下断言${var}不以zhang开始,如果是则抛出msg:${var}是以zhang开始
${var} Set Variable zhengying
Should Not Start With ${var} zhang ${var}是以zhang开始
- Should End With (断言某个字符串以指定值结尾)
- 解释:如下断言${var}以ying结尾,如果不是则抛出msg:${var}不以ying结尾
${var} Set Variable zhengying
Should End With ${var} ying ${var}不是以ying结尾
- Should Not End With (断言某个字符串以指定值结尾)
- 解释:如下断言${var}不以yin结尾,如果是则抛出msg:${var}以yin结尾
${var} Set Variable zhengying Should not End With ${var} yin ${var}是以yin结尾
- Should Be Equal As Integers (以整数形式比较相等)
- 解释:如下断言整数${var}与整数12相等,如果不等则抛出msg:整数${var}与整数12不相等
${var} Set Variable 12
Should Be Equal As Integers ${var} 12 整数${var}与整数12不相等
- Should Be Equal As Numbers(以数字形式比较相等)
- 解释:如下断言数字${var}与数字 1.20 相等,如果不等则抛出msg:${var}与1.20不相等
${var} Set Variable 1.2
Should Be Equal As Numbers ${var} 1.20 整数${var}与整数1.20不相等
- Should Be Equal As Strings (以字符串形式比较相等)
- 解释:如下断言字符串${var}与字符串zhengying相等,如果不等则抛出msg:${var}与zhengying不相等
${var} Set Variable zhengying
Should Be Equal As Strings ${var} zhengying 整数${var}与整数zhengying不相等
- should be empty (断言为空)
- 解释:如下断言${var}为空值,如果不为空值则抛出msg:${var}不为空
${var} Set Variable
Should Be Empty ${var} ${var}不为空
- should not be empty (断言不为空)
- 解释:如下断言${var}不为空值,如果为空值则抛出msg:${var}为空
${var} Set Variable 1 Should not Be Empty ${var} ${var}为空
- Should Be True (断言结果为True)
- 解释:如下断言1<2结果为True,如果结果为false则抛出msg:1不小于2
Should Be True 1<2 1不小于2
- Should Not Be True (断言结果为为False)
- 解释:如下断言1<2结果为False,如果结果为True则抛出msg:1不小于2
Should not Be True 1>2 1不大于2
- Alert Should Be Present 【text | action】
- 断言弹窗内容包含 text,并且消除它
Alert Should Be Present 登录成功 dismiss #结果如下 Alert message should have been '登录成功' but it was '登录失败'.