Automation One By One - Robot Framework - 数据类型

Robot Framework中的数据类型均是通过变量(Variable)来表达的。

Robot Framework提供以下几种数据类型:

1. 字符串:${variable}, ${get value from keyword}, 80 ...  默认均是字符串类型
2. 数值型:表达数值型,必须使用${Numbers}来表示
Test CaseActionArgumentArgumentComment
Example 1AConnectexample.com80# Connect gets two strings as arguments
Example 1BConnectexample.com${80}# Connect gets a string and an integer
Example 2Do X${3.14}${-1e-4}# Do X gets floating point numbers 3.14 and -0.0001

3. 布尔值

Test CaseActionArgumentArgumentComment
BooleanSet Status${true} # Set Status gets Boolean true as an argument
 Create Ysomething${false}# Create Y gets a string and Boolean false


4. Null/None值

Test CaseActionArgumentArgumentComment
NoneDo XYZ${None} # Do XYZ gets Python None as an argument
Null${ret} =Get Valuearg# Checking that Get Value returns Java null
 Should Be Equal${ret}${null} 

上述这些类型的变量均是大小写不敏感的,即 ${True} and ${true} 是相等的. 另外, ${None} and ${null} 属于属于同义词。

5. 空格、Empty

Robot Framework允许你使用${SPACE},${EMPTY}来表示空格及空

Test CaseActionArgumentArgument
One SpaceShould Be Equal${SPACE}\ \
Four SpacesShould Be Equal${SPACE * 4}\ \ \ \ \
Ten SpacesShould Be Equal${SPACE * 10}\ \ \ \ \ \ \ \ \ \ \
Quoted SpaceShould Be Equal"${SPACE}"" "
Quoted SpacesShould Be Equal"${SPACE * 2}"" \ "
EmptyShould Be Equal${EMPTY}\

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值