RobotFramework
如何打包一个 Robot Framework 的 Docker 镜像
· ☕ 3 分钟
为了方便 CI 集成 UI 自动化测试,需要将 Robot Framework 运行环境打包为 Docker 镜像。本篇主要内容是一些与打包过程相关的配置和脚本。 1. 打包目录结构 1 2 3 4 5 6 tree . ├── docker-compose.yml ├── Dockerfile ├── google-chrome.repo ├── requirements_base.txt 1.1 Dockerfile 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 FROM centos:7 ADD ./google-chrome.repo /etc/yum.repos.d/google-chrome.repo

Robot Framework 常用库
· ☕ 3 分钟
1. 标准库 Robot Framework 可以直接导入使用的库,在目录 python\Lib\site-packages\robot\libraries 中。详细说明,可以查看说明文档。 Builtin,包含经常需要的关键字。自动导入无需 import,因此总是可用的。 Dialogs,提供了暂停测试执行和从用户的输入方式。 Collections,提供一组

Robot Framework 进阶 (2)
· ☕ 2 分钟
配置表 Robot Framework 的配置表主要有两种用途。详细说明,请参考这里。 导入测试、资源文件和变量文件。 定义元数据。 在 Setting 表格中: 1 2 3 4 5 Library 引入库 Resource 引入资源文件 Variables 引入变量文件 Test Setup 指定缺省的 test setup Test Teardown 指定缺省的 test teardown 在测试用例中: 1 2 3 4 5 6 [Documentation] 测试用例描述 [Tags] 测试用

Robot Framework 进阶 (1)
· ☕ 3 分钟
pybot 命令 执行所有测试用例 1 pybot . 执行某个测试套件 1 pybot testsuite.txt 执行某个测试套件中的测试用例 1 pybot --test case_name testsuit.txt 将测试结果输出到固定路径 1 pybot --ouputdir your_ouput_dir testsuit.txt 执行包含某个 tag 的测试用例 1 pybot --include tag_name testsuit.txt 关于日志 默认情况下,Robot Framework 中低于 INFO 级别的日志消息不会写日志。这个阈值可以通过命

Jenkins 集成 Robot Framework 自动化测试
· ☕ 3 分钟
1. 安装无头浏览器 1.1 CentOS 安装 Phantomjs 下载并解压 访问 Phantomjs ,找到 Download phantomjs-2.1.1-linux-x86_64.tar.bz2 的下载链接,并拷贝。 在 CentOS 执行命令: 1 2 3 4 5 wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 # 如果没有安装 bzip2 可能会报错 yum install bzip2.x86_64 tar -jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2 mv phantomjs-2.1.1-linux-x86_64 /usr/local/ 添加到环境变量 1 vim /etc/profile 在行尾新增,如下内容 1 export PATH=$PATH:/usr/local/phantomjs-2.1.1-linux-x86_64/bin 使环境变量立即生效 1 source /etc/profile 查看 Phantomjs 版本号 1 phantomjs --version 安装完之