项目进入维护阶段,需要使用Robotframework进行日常的版本验证,尝试在ubuntu下搭建测试环境。
官方文档:https://github.com/robotframework/robotframework/blob/master/INSTALL.rst
参考: http://blog.csdn.net/youcharming/article/details/45341493
- 操作系统:Ubuntu -- 最初使用Ubuntu 16版本,发现wxpython 和 ride无法自动更新成匹配的版,取了个巧,奖Ubuntu版本降到14重新配置,后续再尝试如何手动安装。
root@ubuntu:~# uname -ar Linux ubuntu 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:43:42 UTC 2014 i686 athlon i686 GNU/Linux root@ubuntu:~# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"
- Python: 2.7.9 -- 可能存在python2 和 python3同时存在的情况,安装时需要注意所需 robotframework 运行在python2环境。
root@ubuntu:~# python Python 2.7.6 (default, Mar 22 2014, 22:59:38) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.
- Installation
- 更新 apt-get
sudo apt-get update sudo apt-get upgrade
- easy_install / pip,linux通过以上两个工具自动安装
easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall
pipsudo apt-get install python-setuptools python-dev build-essential
sudo apt-get install python-pip
- install robotframwork
pip install robotframework
root@ubuntu:~# robot --version Robot Framework 3.0.2 (Python 2.7.6 on linux2) root@ubuntu:~# rebot --version Rebot 3.0.2 (Python 2.7.6 on linux2)
- install selenium
selenium
selenium libraryroot@ubuntu:~# pip install selenium Requirement already satisfied (use --upgrade to upgrade): selenium in /usr/local/lib/python2.7/dist-packages/selenium-3.6.0-py2.7.egg
pip install robotframework-seleniumlibrary 或 pip install robotframework-selenium2library
- install wxpython -- python GUI 库,用来支持ride图形界面,目前ride只支持2.8版本
apt-get install python-wxgtk2.8
- install ridehttps://github.com/robotframework/RIDE/wiki/Installation-Instructions
pip install robotframework-ride 或 pip install ride
- download webdriver for firefox
https://github.com/mozilla/geckodriver/releases
解压后 添加到path或放到/usr/bin路径下 - run ride
https://github.com/robotframework/RIDE/wiki/Installation-Instructions
ride.py
- 更新 apt-get
- 环境验证
- create project
- create test suite
- create test case
- create test step
*** Settings *** Library Selenium2Library *** Test Cases *** setf Open Browser http://www.baidu.com ff
- 后续工作
- ride环境的使用,更多环境插件的配置
- 所需系统验证脚本的实现
- 非ride环境下如何进行系统验证代码的编写
- Question
- Ubuntu 16版本通过pip自动下载到的wxpython为3,所以降低Ubuntu版本到14后完成配置,16版本的手动安装后续再试
- 启动ride编辑器后,菜单栏无法显示
原因:su root所拥有的配置权际不足,改为root直接登录或su - root切换用户后解决。 - OSError: [Errno 8] Exec format error,执行脚本时直接报错
原因:使用的firefox webdriver版本不符,检查firefox版本后重新下载解决