zoukankan      html  css  js  c++  java
  • Pytest插件

    Pytest插件

    插件列表网址:https://plugincompat.herokuapp.com,包含了很多插件包

    一、调整测试用例的执行顺序

    安装:pip install pytest-ordering

    在测试方法上加下面装饰器

    @pytest.mark.last
    #最后一个执行
    @pytest.mark.run(order=1)
    #第几个执行
    

    二、用例失败重试

    安装:pip install pytest-rerunfailures

    命令行参数:--reruns n(重新运行次数),--reruns-delay m(等待运行秒数)

    pytest --reruns 5
    

    装饰器参数:reruns=n(重新运行次数),reruns_delay=m(等待运行秒数)

     @pytest.mark.flaky(reruns=5)
    

    三、多重校验

    如果需要多个断言,都执行就需要第三方插件 pytest-assume

    安装:pip install pytest-assume

    def test_add2(self):
        pytest.assume(add(1,2)==3)
        pytest.assume(add(1,4)==3)
        pytest.assume(add(2,2)==4)
    

    四、pytest-html生成报告

    安装:pip install pytest-html

    命令行参数:--html=report.html

    pytest --html=report.html
    
  • 相关阅读:
    secFox setting
    Xmind settings lower
    Test435678
    Cmd管理员运行
    office install problems
    MSOCache office问题
    WeRun is mini-app
    解决谷歌跨域调试不可用
    xml文件读写
    c++ 矩阵运算库 Eigen等
  • 原文地址:https://www.cnblogs.com/lazy-sang/p/13700435.html
Copyright © 2011-2022 走看看