- 内置库(标准库)
直接绑定在Robot Framework内,在
\Lib\site-packages\robot\liraries
- 扩展库
需要根据个人的需求进行下载
标准库
无需下载,直接导入即可使用。
自动加载到内存,无需导入的Builtin
使用前需要导入的Dialogs,Collections,OperatingSystem,Remote,Screenshot,String,
Telnet,XML,Process,DateTime
-
Dialogs:暂停测试执行,接收从用户输入 -
Collections:处理列表和自动 -
OperatingSystem:处理操作系统相关 -
Remote:远程库接口的一部分,自己没啥关键字 -
Screenshot:捕获和存储桌面的截图 -
String:处理字符串 -
Telnet:连接Telnet服务器 -
XML:操作XML -
Process:系统中运行过程的库 -
DateTime:日期和时间转换的库
扩展库
常用的一些扩展库:
HTTP协议的库
Robot Framework-RequestsHTTP Library
Web UI测试的库
Selenium2LiraryRobot Framework-Selenium2Screenshots
FTP操作的库
FTP Library
SSH操作的库
SSHlibrary
JSON操作的库
Robot Framework-JsonLibrary
Evaluate 万能关键字
可以直接运行python脚本
查找Evaluate
使用
- 设置变量
result为3.14 - 使
status等于0<result<10
结果
类型转换
常见的转换:
Convert To
-
String字符串 -
Integer符点数 -
Boolean布尔值
变量操作
- 打印变量
Log Variables - 导入变量
Import Variables 设置变量
Set Variables获取变量
Get Variables Value
关键字操作
- 运行关键字
Run Keyword - 当条件满足时运行
Run Keyword If 当条件不满足时运行
Run Keyword Unless运行多个关键字
Run Keywords运行关键字并返回结果
Run Keyword And Return
条件与循环
- 直接继续下一次循环
Continue For Loop - 当条件满足时继续下一次循环
Continue For Loop If - 立即退出循环
Exit For Loop - 满足条件退出循环
Exit For Loop If
断言
以下都已:Should (Not)开头
断言是否为空
Be Empty断言是否相等
Be Equal- 字符串是否相等
Be Equal As String - 整数是否相等
Be Equal As Integers - 是否为真
Be True - 是否包含某元素
Contain - 是否包含任一元素
Contain Any - 某元素被包含的次数
Contain X Times - 是否以某某开头
Start With - 是否以某某结尾
End With - 是否符合正则表达式
Match Regexp
其他:
- 长度是否相等
Length Should Be - 关键字是否存在
Keyword Should Exist - 列表是否包含某值
List Should (Not) Contain Value - 两个列表是否相等
Lists Should Be Equal - 列表不包含重复项
List Should Not Contain - 字典是否包含某键值对
Dictionary Should Contain Item - 字典是否包含某key值
Dictionary Should (Not) Contain Key - 字典是否包含某value值
Dictionary Should (Not) Contain Value - 字典是否相等
Dictionary Should Be Equal
常用关键字
- 打印内容
Log - 延时等待
Sleep - 添加注释
Comment - 获取数量,长度,时间
Get+Count/Length/Time - 导入测试库
Import Library