首页 > 代码库 > fedora23 安装RobotFramework和Ride
fedora23 安装RobotFramework和Ride
当前主要环境:
fedora23 x86 64
python 2.7.11
pip 7.1.0
一、安装使用RobotFramework
1、安装RobotFramework
pip install selenium
pip install robotframework
pip install robotframework-selenium2library
2、使用RobotFramework
从此处下载web测试demo程序:https://bitbucket.org/robotframework/webdemo 或者我在码云的 fork 地址 https://git.oschina.net/danacai/webdemo 下载后目录如下:
webdemo
├── BUILD.rst
├── demoapp
│ ├── html
│ │ ├── demo.css
│ │ ├── error.html
│ │ ├── index.html
│ │ └── welcome.html
│ └── server.py
├── demoapp.png
├── log.html
├── login_tests
│ ├── gherkin_login.robot
│ ├── invalid_login.robot
│ ├── resource.robot
│ └── valid_login.robot
├── output.xml
├── package.py
├── README.rst
└── report.html
参看README.rst,运行demo程序:
该demo程序提供了一个小的web服务器,运行 python demoapp/server.py 启动小服务器,it is be available in URL http://localhost:7272.
运行robot --variable BROWSER:Chrome login_tests 可指定不同浏览器 (需要安装浏览器对应的 webdriver 程序),并运行login_tests目录下的所有测试用例
自动测试后生成三个文件:报告文件report.html,日志文件log.html,output.xml,输出信息如下:
[myname@localhost webdemo]$ robot --variable BROWSER:Chrome login_tests ============================================================================== Login Tests ============================================================================== Login Tests.Gherkin Login :: A test suite with a single Gherkin style test. ============================================================================== Valid Login | PASS | ------------------------------------------------------------------------------ Login Tests.Gherkin Login :: A test suite with a single Gherkin st... | PASS | 1 critical test, 1 passed, 0 failed 1 test total, 1 passed, 0 failed ============================================================================== Login Tests.Invalid Login :: A test suite containing tests related to inval... ============================================================================== Invalid Username | PASS | ------------------------------------------------------------------------------ Invalid Password | PASS | ------------------------------------------------------------------------------ Invalid Username And Password | PASS | ------------------------------------------------------------------------------ Empty Username | PASS | ------------------------------------------------------------------------------ Empty Password | PASS | ------------------------------------------------------------------------------ Empty Username And Password | PASS | ------------------------------------------------------------------------------ Login Tests.Invalid Login :: A test suite containing tests related... | PASS | 6 critical tests, 6 passed, 0 failed 6 tests total, 6 passed, 0 failed ============================================================================== Login Tests.Valid Login :: A test suite with a single test for valid login. ============================================================================== Valid Login | PASS | ------------------------------------------------------------------------------ Login Tests.Valid Login :: A test suite with a single test for val... | PASS | 1 critical test, 1 passed, 0 failed 1 test total, 1 passed, 0 failed ============================================================================== Login Tests | PASS | 8 critical tests, 8 passed, 0 failed 8 tests total, 8 passed, 0 failed ============================================================================== Output: /home/codc/cabbage_python/webdemo/output.xml Log: /home/codc/cabbage_python/webdemo/log.html Report: /home/codc/cabbage_python/webdemo/report.html
二、使用RobotFramework IDE (Ride) 运行自动化测试demo程序
1、安装 Ride
1.1、 首先要安装Ride 所需要的GUI库 wxPython。
安装 wxPython 所需要的依赖,
sudo dnf install redhat-rpm-config
sudo dnf install python-devel
sudo dnf install gtk-config
当前 pip 下载的最新的 Ride 1.5.2.1 只能使用 wxPython-2.8.12.1 才可以无错误地启动
下载 https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/
从源码安装 wxPython
# 解压 tar -zxvf wxwidgets2.8_2.8.12.1.orig.tar.gz # 配置安装 wxwidgets ./configure --with-gtk --enable-gtk2 --enable-unicode make sudo make install # 安装 wxWidgets contrib modules. cd contrib/ make sudo make install # 由于默认安装在了 /usr/local/lib # 为普通用户或全局设置 LD_LIBRARY_PATH # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib # 在当前源代码目录下安装 wxPython cd ../wxPython sudo python setup.py install
1.2、pip install robotframework-ride
2、启动Ride:ride.py
打开 web demo 的目录login_test,接下来用ride工具编辑查看及运行(略)。
Notice:
安装过程中也遇到了很多错误,可以参阅 fedora23安装robotframework和ride-错误篇
参考:
1. http://stackoverflow.com/questions/14007557/installing-wxpython-on-ubuntu-12-04
2. http://www.cnblogs.com/Allen-ling/p/5912726.html
3. http://blog.csdn.net/q8423127/article/details/52441994
4. http://www.cnblogs.com/fnng/p/3871712.html
5. https://bitbucket.org/robotframework/webdemo
fedora23 安装RobotFramework和Ride