zoukankan      html  css  js  c++  java
  • Robot Framework

    注意:本文内容是以“在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)
    

    环境变量 PYTHONPATHC:Python27;C:Python27Libsite-packages;C:Python27Scripts

    建议执行“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
    
    [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:Usersguowli>set ORACLE_HOME
    ORACLE_HOME=C:instantclient
    
    C:Usersguowli>
    C:Usersguowli>set path
    Path=C:ProgramDataOracleJavajavapath;C:Program Files (x86)RSA SecurID Token Common;C:WINDOWSsystem32;C:WINDOWS;
    C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program Files (x86)WebExProductivity Tools;C:
    Program Files (x86)SennheiserSoftphoneSDK;C:Program Files (x86)SafeComSafeComPrintClient;C:Program FilesTortoise
    SVNin;C:Python27;C:Python27Scripts;C:Python27Libsite-packages;C:Program FilesJavajdk1.8.0_101in;C:Program
    FilesJavajdk1.8.0_101jrein;C:instantclient
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    
    C:Usersguowli>
    

    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)
    >
    
  • 相关阅读:
    浅复制(Shallow Copy)与深复制(Deep Copy)
    使Web API支持二级实体操作,兼对RESTFul风格API设计的疑惑。
    ActionResult
    如何在github上fork一个项目来贡献代码以及同步原作者的修改
    实用技巧:Google 搜索打不开的解决方法
    C# 汉字转拼音
    Windows Server AppFabric的安装、配置与问题排除
    小工具,大智慧(一)                     ——notepad++
    通用软件注册功能之建立有效的软件保护机制
    Javascript MVVM模式前端框架—Knockout 2.1.0系列:目录
  • 原文地址:https://www.cnblogs.com/anliven/p/10010142.html
Copyright © 2011-2022 走看看