1、打印Log
log 跟python的print一样。
2.定义变量
通过 Set Variable 关键字来定义变量
2.1 普通变量
2.2 列表
列表类型可通过 Set Variable 和 Create List 两种方式创建
2.2.1 Set Variable创建
2.2.1.1 创建一维数组
2.2.1.2 创建二维数组
2.2.2 Create List创建
2.2.2.1 创建一维数组
2.2.2.2 创建二维数组
2.2.3 @{} 和 ${} 之间的转换
@{}类型可以通过set variable 和create list将其转换成${}类型;
${}类型只能通过set variable将其转换成@{};
${}类型通过create list将会生成一个只有一个元素的嵌套列表
定义变量 | 关键字 | 赋值 | 结果 | ||
---|---|---|---|---|---|
# @{} 转化为${} | |||||
@{list1} | Set Variable | 1 | 2 | 3 | # @{list1} = [ 1 | 2 | 3 ] |
${list1set@} | Set Variable | @{list1} | # ${list1set@} = [‘1’, ‘2’, ‘3’] | ||
${list1set$} | Set Variable | ${list1} | # ${list1set$} = [‘1’, ‘2’, ‘3’] | ||
${list1create@} | create list | @{list1} | # ${list1create@} = [‘1’, ‘2’, ‘3’] | ||
${list1create$} | create list | ${list1} | # ${list1create$} = [[‘1’, ‘2’, ‘3’]] | ||
log many | ${list1set@}[0] | ${list1set$}[0] | ${list1create@}[0] | ${list1create$}[0][0] | #结果均为 1 |
@{list2} | create list | a | b | c | # ${list2} = [ a | b | c ] |
${list2set@} | Set Variable | @{list2} | # ${list2set@} = [‘a’, ‘b’, ‘c’] | ||
${list2set$} | Set Variable | ${list2} | # ${list2set$} = [‘a’, ‘b’, ‘c’] | ||
${list2create@} | create list | @{list2} | # ${list2create@} = [‘a’, ‘b’, ‘c’] | ||
${list2create$} | create list | ${list2} | # ${list2create$} = [[‘a’, ‘b’, ‘c’]] | ||
log many | ${list2set@}[2] | ${list2set$}[2] | ${list2create@}[2] | ${list2create$}[0][2] | #结果均为 c |
# 将${} 转化为@{} | |||||
${list4} | create list | q | w | e | # ${list4} = [‘q’, ‘w’, ‘e’] |
@{list4create@} | create list | @{list4} | # @{list4create@} = [ q | w | e ] | ||
@{list4create$} | create list | ${list4} | # @{list4create$} = [[‘q’, ‘w’, ‘e’]] | ||
@{list4set@} | Set Variable | @{list4} | # @{list4set@} = [ q | w | e ] | ||
@{list4set$} | Set Variable | ${list4} | # @{list4set$} = [ q | w | e ] | ||
log many | ${list4create@}[2] | ${list4create$}[0][2] | ${list4set@}[2] | ${list4set$}[2] | #结果均为 e |
${list5} | Set Variable | q | w | e | # ${list5} = [‘q’, ‘w’, ‘e’] |
@{list5create@} | create list | @{list5} | # @{list5create@} = [ q | w | e ] | ||
@{list5create$} | create list | ${list5} | # @{list5create$} = [[‘q’, ‘w’, ‘e’]] | ||
@{list5set@} | Set Variable | @{list5} | # @{list5set@} = [ q | w | e ] | ||
@{list5set$} | Set Variable | ${list5} | # @{list5set$} = [ q | w | e ] | ||
log many | ${list5create@}[2] | ${list5create$}[0][2] | ${list5set@}[2] | ${list5set$}[2] | #结果均为 e |
2.2.4 判断字符是否在列表中
2.3 字典
使用字典操作时可提前加载Collections库,该库提供列表、字典的一系列操作。
2.3.1 创建字典
通过create Dictionary 关键字创建字典,
创建字典赋值时有两种方式:
- create dictionary key1=value1 key2=value2
- create dictionary key1 value1 key2 value2
2.3.2 断言字典应包含(需加载库Collections)
2.3.3 查看字典键值
3. 连接catenate
catenate关键字连接字符,默认以空格连接。
4. 时间操作
4.1 获取当前时间
4.2 睡眠
5. IF条件
6. FOR循环
7.Evaluate
evaluate 关键字可用来执行python语言所提供的方法