您的位置:首页 > 其它

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

2011-10-20 17:08 561 查看
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}\
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: