Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### 获取变量的对象名称
- from mymodule import MyObject
- def return_string():
- return "Hello, world!"
- def return_object(name):
- return MyObject(name)
- </nbsp>
- *** Test Cases ***
- Returning one value
- ${string} = Return String
- Should Be Equal ${string} Hello, world!
- ${object} = Return Object Robot
- Should Be Equal ${object.name} Robot
- ### 字符串和数字变量
- RobotFramework的案例数据缺省都是字符串,而`${}`中的内容是由Python解释执行的,所以`${1}`是数字1,`1`是字符串“1”。
- String and Number
- ${str1} = Set Variable 1
- ${str2} = Set Variable 2
- ${num1} = Convert to Integer 1
- ${num2} = Convert to Integer 2
- Should Not Be Equal ${str1} ${num1}
- Should Not Be Equal 1 ${num1}
- Should Be Equal 1+1 ${num1}+1
- Should Not Be Equal 1+1 ${num2}
- Should Not Be Equal 1+1 ${str2}
- Should Be Equal ${num1+1} ${num2}
- Should Be Equal ${num1+1} ${2}
- Should Be Equal ${1+1} ${num2}
- Should Be Equal as Strings ${str1} ${num1}
- ### 数组变量
- *** Test Cases ***
- List Variables
- @{list} = Set Variable first value second value
- Should Be Equal @{list}[0] first value
- Should Be Equal ${list[0]} first value
- Should Be Equal @{list}[1] second value
- Should Be Equal ${list[1]} second value
- ${index} = Set Variable ${2}
- Should Be Equal @{list}[${index - 1}] second value
- Should Be Equal @{list}[${${index} - 1}] second value
- Should Be Equal ${list[2 - 1]} second value
- Should Be Equal ${list[${index} - 1]} second value
- Should Be Equal ${list[${index - 1}]} second value
Add Comment
Please, Sign In to add comment