Giter VIP home page Giter VIP logo

pyautotest's Introduction

pyautoTest Web UI 自动化项目

特点

  • 全局配置浏览器启动/关闭。
  • 测试用例运行失败自动截图。
  • 测试用例运行失败可以重跑。
  • 测试数据参数化。

安装

$ pip install -r requirements.txt

注:安装requirements.txt指定依赖库的版本,这是经过测试的,有时候新的版本可会有错。

配置

config.py 文件配置

class RunConfig:
    """
    运行测试配置
    """
    # 配置浏览器驱动类型。
    driver_type = "chrome"

    # 配置运行的 URL
    url = "https://www.baidu.com"

    # 失败重跑次数
    rerun = "3"

    # 当达到最大失败数,停止执行
    max_fail = "5"

    # 运行测试用例的目录或文件
    cases_path = "./test_dir/"

运行

不支持在编辑器(pycharm/ VS code ...)中运行,请在 cmd(windows)/终端(Linux)下执行。

$ python run_tests.py  (回归模式,生成HTML报告)
$ python run_tests.py -m debug  (调试模式)

警告提示

conftest.py 文件有一行在 pycharm 中提示错误:

from py.xml import html
  • 原因

从源代码判断,py名称空间中的属性是动态创建的,这就是为什么静态分析工具pylint (pycharm)无法识别它们的原因:

apipkg.initpkg(__name__, attr={'_apipkg': apipkg}, exportdefs={
    ...
    # small and mean xml/html generation
    'xml' : {
        '__doc__'            : '._xmlgen:__doc__',
        'html'               : '._xmlgen:html',
        'Tag'                : '._xmlgen:Tag',
        'raw'                : '._xmlgen:raw',
        'Namespace'          : '._xmlgen:Namespace',
        'escape'             : '._xmlgen:escape',
    },
})

所以,是pycharm 不够智能!你可以忽略这个错误。

pyautotest's People

Contributors

fnngj avatar defnngj avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.