Raul2018

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

From: https://www.cnblogs.com/yanjiahong/p/15006257.html

 

定义两个函数

${int}   create list  1 2 3
${string}   set variable   i love python
${null}   create list  

1.should be ture 和 should not be ture
断言结果为真ture/断言结果为假fail:

should be ture   ${int[0]}<2   #这个断言通过,1<2,可以使用逻辑判断
should be ture   ${string}   #这个通过,有返回值

2.should be equal 和 should not be equal
断言两个数据相同/两个不同

should be equal   ${int}   [1,2,3]  #此断言为真,两个相同
should not be equal   ${string}   ${int}    #此断言通过,两个不相同

3.should contain 、 should not contain 与should contain x times
断言A包含B、断言A不包含B 、断言对象出现次数

should contain   ${int}   1   #此断为真, ${int}中包含1
should not contain   ${int}   4   #此断为真, ${int}中不包含4
should contain x times   ${string}   o  2  #此断为真,o出现2次

4.should be empty 与 should not be empty
断言结果为空/断言结果不为空

should be empty   ${null}   #此断言为真,,结果是空
should not be empty   ${int}   #此断言为真,结果不为空

5.Should start With与Should not start With
断言结果以什么开头/断言不以什么开头

Should start With   ${string}   i   #结果正确,以i开头
should not start empty   ${string}   a   #结果正确,不以a开头

6.Should End With与Should not End With
断言结果以什么结尾/断言不以什么结尾

Should end With   ${string}   n   #结果正确,以n结尾
should not end empty   ${string}   o   #结果正确,不以o结尾

7.should match与should not match
断言匹配,类似正则匹配

should match   ${string}   i love pyt???   #结果为真,’?'表示当个字符
should not match   ${string}   l*   #结果为真,‘*’表示0-无穷个字符

8.Should Be Equal As Integers与Should not Be Equal As Integers
转化成字符串类型在对比
————————————————
版权声明:本文为CSDN博主「saber_sss」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/saber_sss/article/details/110558840

posted on 2022-12-26 14:56  Raul2018  阅读(112)  评论(0编辑  收藏  举报