zoukankan      html  css  js  c++  java
  • pytest 框架生成 pytest

       需要安装 pytest - html 插件;

    pip install pytest-html
    • pytest 可以生成多种样式的结果:
    • 生成 JunitXML 格式的测试报告,命令:--junitxml=path
    • 生成 ResultLog 格式的测试报告,命令:--resultlog=report/log.txt
    • 生成 Html 格式的测试报告,命令:--html=OutPuts/reports/report.html(相对路径)

    二、生成 HTML 报告

    if __name__ == '__main__':
        # 生成python-html报告
        pytest.main(['-s', '-v', '--html=OutPuts/reports/report.html'])

      生成测试报告:

       打开测试报告:

    • report.html
      • 什么时候生成的报告  
    • Environment:环境
      • 包  
      • 平台版本  
      • 插件版本  
      • Python版本  
    • Summary
      • 运行了几个用例,用了多少秒  
      • passed:通过、failed:失败、errors:报错
    • Duration:运行耗时秒

    三、其中可以结合 失败重运行机制:

    import pytest
    
    if __name__ == '__main__':
        # 生成python-html报告
        pytest.main(['--reruns', '3', '--reruns-delay', '5', '-s', '-v', '--html=Outputs/reports/report.html'])

    如果看到控制台中看到 RRF 代表两次重运行,最后还是失败了

    *******请大家尊重原创,如要转载,请注明出处:转载自:https://www.cnblogs.com/shouhu/,谢谢!!******* 

  • 相关阅读:
    Linux kernel device mapper
    草莓网
    openwrt系统源码地址
    ubuntu 安装eclipse for c++
    ubuntu下安装eclipse IDE for C/C++ developers
    Makefile 中:= ?= += =的区别
    core dump
    rtp
    skbuff
    A Neural Algorithm of Artistic Style
  • 原文地址:https://www.cnblogs.com/shouhu/p/12393144.html
Copyright © 2011-2022 走看看