弘望舒 发表于 2016-5-18 07:39:58

搭建RobotFrameWork测试环境(Mac版)

才用mac os x不久,很多操作不熟悉,参照下文一边装一边试,最终还是跑起来了。
安装的一些细节和下文有所出入,仅供参考。
系统环境:
   * Mac OS X 10.8.3
   * 自带 Python 2.7.2
安装 pip, 详见:http://guide.python-distribute.org/installation.html

wget http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz
tar xzf pip-0.7.2.tar.gz
cd pip-0.7.2sudo python setup.py install


# install distribute

wget http://python-distribute.org/distribute_setup.py


安装 robotframework

wget https://robotframework.googlecode.com/files/robotframework-2.7.7.tar.gz
tar zxvf robotframework-2.7.7.tar.gz
cd robotframework-2.7.7
sudo python setup.py install
# test installation
pybot --version
# install selenium2librarysudo
pip install robotframework-selenium2library


运行测试用例hello.txt
在hello.txt的目录执行命令

pybot hello.txt


robot默认使用Firefox作为启动浏览器,如果要使用其他浏览器(如Chrome),需要安装相应的Driver

wget https://chromedriver.googlecode.com/files/chromedriver2_mac32_0.8.zip
unzip chromedriver2_mac32_0.8.zip
sudo cp chromedriver2_mac32_0.8/chromedriver /usr/bin


通过Python测试Chromedriver:

$ python
>>> from selenium import webdriver
>>> driver = webdriver.Chrome()
>>> driver.get("http://www.google.com")


修改case,重新执行 pybot hello.txt(如果报浏览器找不到错误,尝试重启系统)

Open Browserhttp://www.google.comChrome


安装 RobotFramework IDE,参见:https://github.com/robotframework/RIDE/wiki/Installation-Instructions

wget https://robotframework-ride.googlecode.com/files/robotframework-ride-1.1.tar.gz
tar zxvf robotframework-ride-1.1.tar.gz
cd robotframework-ride-1.1
sudo python setup.py install


参考

* BuiltIn Keywords:http://robotframework.googlecode.com/hg/doc/libraries/BuiltIn.html?r=2.6.1
* Selenium2Library Keywords:
https://github.com/rtomac/robotframework-selenium2library/blob/master/doc/Selenium2Library.html
* Selenium2Library On GitHub:
https://github.com/rtomac/robotframework-selenium2library
* RIDE Overview:
http://blog.codecentric.de/en/2012/01/robot-framework-ide-ride-overview/
* AutoIt doc:
http://www.iyunv.net/shouce/autoit/index.html
页: [1]
查看完整版本: 搭建RobotFrameWork测试环境(Mac版)