Automation One By One - Robot Framework - 数据类型
上一篇 /
下一篇 2011-07-29 10:19:31
/ 个人分类:Robot Framework
Robot Framework中的数据类型均是通过变量(Variable)来表达的。
Robot Framework提供以下几种数据类型:
1. 字符串:${variable}, ${get value from keyword}, 80 ... 默认均是字符串类型
2. 数值型:表达数值型,必须使用${Numbers}来表示
Test Case |
Action |
Argument |
Argument |
Comment |
Example 1A |
Connect |
example.com |
80 |
# Connect gets two strings as arguments |
Example 1B |
Connect |
example.com |
${80} |
# Connect gets a string and an integer |
Example 2 |
Do X |
${3.14} |
${-1e-4} |
# Do X gets floating point numbers 3.14 and -0.0001 |
3. 布尔值
Test Case |
Action |
Argument |
Argument |
Comment |
Boolean |
Set Status |
${true} |
|
# Set Status gets Boolean true as an argument |
|
Create Y |
something |
${false} |
# Create Y gets a string and Boolean false |
4. Null/None值
Test Case |
Action |
Argument |
Argument |
Comment |
None |
Do XYZ |
${None} |
|
# Do XYZ gets Python None as an argument |
Null |
${ret} = |
Get Value |
arg |
# 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 Case |
Action |
Argument |
Argument |
One Space |
Should Be Equal |
${SPACE} |
\ \ |
Four Spaces |
Should Be Equal |
${SPACE * 4} |
\ \ \ \ \ |
Ten Spaces |
Should Be Equal |
${SPACE * 10} |
\ \ \ \ \ \ \ \ \ \ \ |
Quoted Space |
Should Be Equal |
"${SPACE}" |
" " |
Quoted Spaces |
Should Be Equal |
"${SPACE * 2}" |
" \ " |
Empty |
Should Be Equal |
${EMPTY} |
\ |
收藏
举报
TAG: