注意:本文内容是以“在Window7系统中安装本地RobotFrmamework自动化测试环境”为例。

Robot Framework简介

Robot Framework documentation:http://robotframework.org/robotframework/
  • Robot Framework 是一款基于 Python 的功能自动化测试框架;
  • 具备良好的可扩展性,支持关键字驱动,可以同时测试多种类型的客户端或者接口,可以进行分布式测试执行;
  • 可用于验收测试和验收测试驱动开发(ATDD);

安装RIDE

安装顺序:Python ---> setuptools & pip ---> Robot Framewok ---> wxPython(v2.8.12.1) ---> RIDE

1-安装Python并设置环境变量

>python --version
Python 2.7.12 >
>pip list
pip (8.1.1)
setuptools (20.10.1)

环境变量 PYTHONPATH: C:\Python27\;C:\Python27\Lib\site-packages;C:\Python27\Scripts

建议执行“python -m pip install --upgrade pip ”升级pip。

2-安装robotframework

根据需要搜索并下载对应源码的压缩包(.tar.gz或.zip),解压后,切换到对应目录,运行:python setup.py install即可安装.

>pybot --version
Robot Framework 3.0 (Python 2.7.12 on win32)

3-安装wxPython

wxPython2.8-win64-unicode-2.8.12.1-py27.exe
 
4-安装robotframework-ride
>ride.py  # 启动RIDE

5-确认已完成所有安装

>pip list
pip (8.1.2)
robotframework (3.0)
robotframework-ride (1.5.2.1)
setuptools (20.10.1)
>

安装SSH访问库

安装顺序:

  1. PyCrypto
  2. ecdsa 
  3. paramiko
  4. robotframework-sshlibrary

确认所有安装包

>pip list
ecdsa (0.13)
paramiko (1.14.0)
pip (8.1.2)
pycrypto (2.6)
robotframework (3.0)
robotframework-ride (1.5.2.1)
robotframework-sshlibrary (2.1.2)
setuptools (20.10.1)
>

验证

>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import SSHLibrary
>>>
>>> ssh = SSHLibrary.SSHLibrary()
>>> ssh.open_connection("10.92.111.76", "22")
1
>>> ssh.login("root", "arthur")
u'Last login: Wed Aug 17 12:32:25 2016 from 10.141.98.107\r\r\n[root@clab395node01 ~]# '
>>> print ssh.execute_command("whoami")
root
>>>

安装Oracle

1 - Oracle Instant Client

Oracle Instant Client provides Oracle access and allows you to run your applications without installing the standard Oracle client.

Since Oracle Instant Client is composed of basic instant client  and the sdk instant client ,   thus two of them should be installed.

Unzip the packages(both instantclient-basic and instantclient-sdk) into a single directory such as "instantclient", in this instruction, the Oracle Instant Client's folder structure looks like:

To set environment variable, open environment variables setting,

new a system variable named ORACLE_HOME, set its value with the Oracle  Instant Client installation path and  append ORACLE_HOME to path. See:

C:\Users\guowli>set ORACLE_HOME
ORACLE_HOME=C:\instantclient C:\Users\guowli>
C:\Users\guowli>set path
Path=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\RSA SecurID Token Common;C:\WINDOWS\system32;C:\WINDOWS;
C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\WebEx\Productivity Tools;C:\
Program Files (x86)\Sennheiser\SoftphoneSDK\;C:\Program Files (x86)\SafeCom\SafeComPrintClient;C:\Program Files\Tortoise
SVN\bin;C:\Python27;C:\Python27\Scripts;C:\Python27\Lib\site-packages;C:\Program Files\Java\jdk1.8.0_101\bin;C:\Program
Files\Java\jdk1.8.0_101\jre\bin;C:\instantclient
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC C:\Users\guowli>

2 - cx_Oracle

cx_Oracle is a Python extension module that allows access to Oracle databases and conforms to the Python database API specification.

3 - SQLAlchemy

SQLAlchemy is Python library that allows database connections directly from Python code, helps in handling results and also allows using Python's/SQLAlchemys's own exception handling. It could be compared in JAVA's jdbc library.

确认所有安装包:

>pip list
cx-Oracle (5.1.2)
ecdsa (0.13)
paramiko (1.14.0)
pip (8.1.2)
pycrypto (2.6)
robotframework (3.0)
robotframework-ride (1.5.2.1)
robotframework-sshlibrary (2.1.2)
setuptools (20.10.1)
sqlalchemy (0.5.6)
>

验证

>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import sqlalchemy
>>>
>>> host="10.92.111.76"
>>> port="1521"
>>> database="oss"
>>>
>>> connect_str = "oracle://omc:omc@" + str(host) + ":" + str(port) + "/" + str(database)
>>> engine = sqlalchemy.create_engine(connect_str, echo=False)
>>> c = engine.connect()
>>>
>>> result = c.execute("select owner,object_type from all_objects where object_name='FM_ALARM'").fetchall()
>>>
>>> print result
[('PUBLIC', 'SYNONYM'), ('FM', 'VIEW')]
>>>

安装Selenium库

SeleniumLibrary is a  Robot Framework  test library that uses the popular  Selenium  web testing tool internally.

It provides a powerful combination of simple test data syntax and support for  different browsers .

Web testing TA cases requires SeleniumLibrary.

安装顺序:
  1. decorator
  2. Selenium
  3. robotframework-selenium2library
  4. IEDriverServer - (optional, for IE explorer)

确认所有安装包:

>pip list
cx-Oracle (5.1.2)
decorator (4.0.10)
ecdsa (0.13)
paramiko (1.14.0)
pip (8.1.2)
pycrypto (2.6)
robotframework (3.0)
robotframework-ride (1.5.2.1)
robotframework-selenium2library (1.7.4)
robotframework-sshlibrary (2.1.2)
selenium (2.53.2)
setuptools (20.10.1)
sqlalchemy (0.5.6)
>

最新文章

  1. Delphi中Interface接口的使用方法
  2. 体系结构设计MVC
  3. Android开发之错误:elicpse运行时弹出Running Android Lint has encountered a problem failed, nullpointerexception
  4. 1104解决ecos挂件中数组传递的相关问题。
  5. Jasper_filter data_pass field data from main to sub to filter some data
  6. 怎样制作百度recovery【转】
  7. spring boot高性能实现二维码扫码登录(下)——订阅与发布机制版
  8. 使用lombok 注解Java类
  9. win10只有edge浏览器能上网的解决方法
  10. loc iloc函数的区别
  11. linux 解决乱码问题
  12. webpack打包去掉console.log打印与debugger调试
  13. switfmailer 邮件时间错误 处理
  14. 文本adversarial examples
  15. series of Nimble
  16. 浅析Android Camera开发中的三个尺寸和三种变形 (贡献一个自适配Picturesize和Previewsize的工具类)
  17. 怎样用MathType输入带分数
  18. ubuntu18 安装apache2.4 php5.6 mysql5.6
  19. c++ poco 使用mysql中文乱码问题
  20. java常用正则校验工具类

热门文章

  1. Saliency Detection: A Spectral Residual Approach
  2. hive资料
  3. 使用Tenorshare iCareFone for mac为iPhone做系统修复
  4. Jackson注解简介
  5. PostgreSQL时间段查询
  6. 别人的Linux私房菜(15)磁盘配额与高级文件系统管理
  7. oracle存储过程 out cursor
  8. Spring Boot的Maven配置
  9. js怎么把数字转化为字母(A,B.....AA,AB,..)
  10. java策略设计模式