RF-标准库

标准库 BuiltIn - 1

介绍:

  • 标准库里面是经常用到的关键字,这个库不需要导入,自动导入,可直接使用

常用关键字

日志相关

  • Log
  • Log Many
  • Log To Console
  • Log Variables

实例

*** Variables ***
@{newList}    tom    kite    rose
&{newDict}    key=value    k2=v2
${name}    ghz

*** Test Cases ***
case01
    Log    hello
case02
    Log To Console    hello
case03
    Log Many    @{newList}
    Log Many    &{newDict}
case04
    Log Variables  
  • Get Count
  • Get Length
  • Get Time
  • Get Variables
  • Get Variable Value

实例

*** Variables ***
@{newList}    1    1    1    2    2    3

*** Test Cases ***
case01
    ${count}   Get Count    ${newList}    1
    Log    ${count}
case02
    ${len}    Get Length    ${newList}
    Log    ${len}
case03
    ${item}    Get Time
    Log    ${item}
case04
    ${vars}    Get Variables
    Log    ${vars}
case05
    ${value}    Get Variable Value    ${EXECDIR}
    Log    ${value}
  • Call Method
  • Catenate
  • Comment
  • Evaluate
  • No Operation
  • Sleep

实例

*** Variables ***
@{newList}    tom    kite    rose

*** Test Cases ***
case01
    ${res}    Catenate    @{newList}
    Log    ${res}
case02
    Log    case02
    Comment    注释
case03
    ${res}    Evaluate    1+2
    Log    ${res}
case04
    No Operation
case05
    Sleep    3
    Log    hello

标准库BuiltIn - 2

验证相关关键字

  • Should Be Empty
  • Should Be Equal
  • Should Be Equal As Integers
  • Should Be Equal As Numbers
  • Should Be True
  • Should Be Equal As Strings
*** Comments ***
这里是注释

*** Variables ***
@{newList}

*** Test Cases ***
case01
    Should Be Empty    ${newList}
case02
    Should Be Equal    1    1
case03
    Should Be Equal As Integers    0b101    5
case04
    Should Be Equal As Numbers    1.23    1.24    precision=1
case05
    Should Be Equal As Strings    3.14    ${3.14}
  • Should Contain

  • Should Contain Any

  • Should Contain X Times

  • Should End With

  • Should Match

  • Should Match Regexp

*** Comments ***
这里是注释

*** Variables ***
@{newList}    item    item

*** Test Cases ***
case01
    Should Contain    ${newList}    item
case02
    Should Contain Any    ${newList}    item    item2
case03
    Should Contain X Times    ${newList}    item    2
case04
    Should End With    dem.py    py
case05
    Should Match    hello123    hello*
case06
    Should Match Regexp    123    \\d{3}
  • Should Not Be Empty
  • Should Not Be Equal
  • Should Not Be Equal As Integers
  • Should Not Be Equal As Numbers
  • Should Not Be Equal As Strings
  • Should Not Be True
  • Should Not Contain
  • Should Not Contain Any
  • Should Not End With
  • Should Not Match
  • Should Not Match Regexp
  • Should Not Start With
  • Should Start With
*** Comments ***
这里是注释

*** Variables ***
@{newList}    item

*** Test Cases ***
case01
    Should Not Be Empty    ${newList}
case02
    Should Not Be Equal    1    2
case03
    Should Start With    hello.py    hell

标准库BuiltIn - 3

类型转换相关

  • Convert To Boolean
  • Convert To Bytes
  • Convert To Hex
  • Convert To Integer
  • Convert To Number
  • Convert To Octal
  • Convert To String
*** Comments ***
这里是注释

*** Test C
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值