常用断言关键字(rf中)

断言关键字

描述

Should Be Empty

判断是否为空,如果不为空,执行失败,示例:

${value}

Set Variable

Hello

Should Be Empty

${value}

结果不为空

 

Should Start With

判断某个字符串是否以预期执行的字符串开始,如果以指定的字符串开头,则执行成功,否则执行失败,示例

${value}

Set Variable

Hello

 

Should Start With

${value}

qq

字符串${value}不以qq开头

 

Should Not Start With

与Should Start With刚好相反,如果以指定的字符串开头,则执行失败,否则执行成功,示例:

${value}

Set Variable

Hello

 

Should Not Start With

${value}

qq

字符串${value}是以qq开头

 

Should Match

判断某个字符串是否与预期指定的字符串相匹配,如果可以匹配,则执行成功,否则执行失败,示例:

${value}

Set Variable

Hello

 

Should Match

${value}

qq

字符串${value}不可以匹配qq

 

Should Not Match

与Should Match刚好相反,如果字符串匹配,则执行失败,否则执行成功,示例:

${value}

Set Variable

Hello

 

Should Match

${value}

Hello

字符串${value}可以匹配hello

 

Should Contain X Times

与Should Contain 关键字类似,用来判断指定的字符串包含指定的字符或者字符串多少次,示例:

${value}

Set Variable

hello

 

 

Should Contain X Times

${value}

hello

3

${value}中没有3次包含字符串hello

 

Should Be Equal As Integers

以整数的形式来进行比较,示例:

${value}

Set Variable

12

 

Should Be Equal As Integers

${value}

13

12和13不相等

 

Should Be Equal As Strings

以字符串的形式来进行比较,示例:

${value}

Set Variable

q

 

Should Be Equal As Integers

${value}

13

q和13不相等

 

Should Be Equal As Numbers

以number的形式来进行比较,示例:

${value}

Set Variable

1.0

 

Should Be Equal As Integers

${value}

1

1.0等于1

 

Should Not Be Equal

与should be equal 用法相反,当带比较的两个值相等时,执行失败,否则执行成功,示例:

${value}

Set Variable

1.0

 

Should Not Be Equal

${value}

1.0

1.0等于1.0

 

Should Not Be Empty

与should be empty 用法相反,如果为空,执行失败,示例:

${value}

Set Variable

Hello

Should Not Be Empty

${value}

字符串${value}为空

posted on 2018-08-14 18:03  打不倒的亮晶晶  阅读(766)  评论(0编辑  收藏  举报