码迷,mamicode.com
首页 > 其他好文 > 详细

robot framework-断言

时间:2018-04-23 00:25:44      阅读:323      评论:0      收藏:0      [点我收藏+]

标签:匹配   match   区分   精度   contain   name   区分大小写   cas   with   

*** Test Cases ***
断言一
    #01、should contain 、 should not contain 与should contain x times
    @{list1}=    create list    3    a    ${28}    22    25 
    @{list2}=    set variable    3.0    a    ${28}    22    22
    @{list3}=    create list    
    ${string1}=    set variable    cq is a girl
    ${name}=    set variable    cq
    should contain    ${list2}    3.0
    should not contain    ${list2}    3
    should contain x times    ${list2}    22    2

断言二
    #should be empty 与 should not be empty
    @{list1}=    create list    3    a    ${28}    22    25 
    @{list2}=    create list
    ${list3}=    create list    cq
    should be empty    ${list2}
    should not be empty    ${list1}

断言三
    #should be equal 与 should not be equal
    @{list1}=    create list    3    a    ${28}    22    22    3.0
    should be equal    ${list1[3]}    ${list1[4]}
    should not be equal    ${list1[0]}    ${list1[5]}

断言四
    #Should Be Equal As Numbers 与 Should not Be Equal As Numbers
     @{list1}=    create list    3    a    ${28}    22    3.98    3.0 
     should be equal as numbers    ${list1[0]}    ${list1[5]}
     should not be equal as numbers    ${list1[0]}    ${list1[4]}
     #说明:${list1[0]}=3,忽略精度,与3.0相等;忽略精度,1与3.98还是不相等的

断言五
    #Should Be Equal As Integers与Should not Be Equal As Integers
    @{list1}=    create list    3    a    ${28}    22    3.98    3.0    3    ${3}
    should be equal as Integers    ${list1[0]}    ${list1[6]}
    should not be equal as Integers    ${list1[0]}    ${list1[3]}

断言六
    #Should Be True与Should not Be True
    @{list1}=    create list    3    a    ${28}    22    3.98    3.0    3    ${3}
    should be true    ${list1[0]}<${list1[3]}
    should not be true    ${list1[4]}<${list1[0]}  

断言七
    #Should start With与Should not start With 
    ${string1}=    set variable    cq is a girl
    should start with    ${string1}    cq
    should not start with    ${string1}    cd   

断言八
    #Should End With与Should not End With
    ${string1}=    set variable    cq is a girl
    should end with    ${string1}    girl
    should not end with    ${string1}    girls  

断言九
    #should match与 should not match
    @{list1}=    create list    cq    a    ${28}    22    3.98    3.0    3    ${3}
    should match    ${list1[0]}    c?
    should not match    ${list1[0]}    a?
    #模式匹配和shell中的通配符类似,区分大小写,‘*‘匹配0~无穷多个字符,“?”匹配单个字符

 

robot framework-断言

标签:匹配   match   区分   精度   contain   name   区分大小写   cas   with   

原文地址:https://www.cnblogs.com/chengchengla1990/p/8910333.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!