• robot framework-断言


    *** 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~无穷多个字符,“?”匹配单个字符
  • 相关阅读:
    Windows Phone 一步一步从入门到精通
    备忘录模式(Memento)
    开放封闭原则(OCP)
    建造者模式(Bulider)
    原型模式(Prototype)
    Windows Workflow Foundation(WF) 一步一步从入门到精通
    模板方法模式
    代理模式(Proxy)
    装饰模式(Decorator)
    迪米特法则(LoD)最少知识原则
  • 原文地址:https://www.cnblogs.com/chengchengla1990/p/8910333.html
Copyright © 2020-2023  润新知