这篇主要写一些关于should和Convert的关键词
第一个 Should Be Empty 顾名思义含义就是变量应该是空
每个变量的值,会在实现代码中给出
用法 例如 : Should Be Empty ${d}
第二个 Should Be Equal 两个值应该相等
用法 例如: should be equal ${b} ${4}
第三个 Should Be Equal As Integers 两个值得整数部分相同
用法 例如: Should Be Equal As Integers ${b} ${4.6}
第四个 Should Be Equal As Numbers 两个数应该相同
用法 例如 : Should Be Equal As Numbers ${b} ${4.0}
第五个 Should Be Equal As Strings两个字符串应该相等
用法 例如:Should Be Equal As Strings ${a} 3+1
第六个 Should Be True 比较后应该是true
用法 例如 :Should Be True ${b}<9
第七个 Should Contain 应该包含
用法 例如: Should Contain ${a} 3
第八个 Should Contain X Times出现几次
用法 例如 : Should Contain X Times ${a} 3 1
第九个 Should End With 以什么结尾
用法 例如: Should End With ${a} 1
第十个 Should Match 通配符
用法 例如:Should Match ${a} 3?*
第十一个 Convert To Boolean 将变量转成Boolean
用法 例如 :${boolean} Convert To Boolean ${c}
第十二个 Convert To Number 转换成数字
用法 例如 : ${int} Convert To Number ${f}
第十三个 Evaluate 一般有关数字计算方面的
用法 例如 : ${b} Evaluate ${a}
效果: 把 3+1 变成 4
第十四个 set variable 赋值
用法 例如:${a} set variable 3+1
效果 : 把3+1 赋值给 ${a}
实现代码如下(其实还有很多没有写出来例如Should Not Be Empty, Convert to hex........):
*** test cases *** test should ${a} set variable 3+1 ${b} Evaluate ${a} ${c} set variable this is a str ${f} set variable 2 ${d} set variable ${empty} Should Be Empty ${d} should be equal ${b} ${4} Should Be Equal As Integers ${b} ${4.6} Should Be Equal As Numbers ${b} ${4.0} Should Be Equal As Strings ${a} 3+1 Should Be True ${b}<9 Should Contain ${a} 3 Should Contain X Times ${a} 3 1 Should End With ${a} 1 Should Match ${a} 3?* Should Not Be Empty ${c} ${s} Convert To Boolean ${c} Log to console ${s} ${int} Convert To Number ${f} Log to console ${int}OK,下篇会写关于 *** keywords ***,*** variables ***和*** settings ***一般用法
转载于:https://www.cnblogs.com/GaryNie/p/10062688.html
相关资源:JAVA上百实例源码以及开源项目