zoukankan      html  css  js  c++  java
  • pytest扫盲20--HTML报告

    插件:pytest-html

    github源码: https://github.com/pytest-dev/pytest-html

    安装:

    pip install pytest-html -i https://pypi.tuna.tsinghua.edu.cn/simple
    

    执行:

      命令行执行:  pytest --html=report/test.html

      独立显示(发送html报告后,CSS样式不会丢失):  pytest --html=report/test.html --self-contained-html

      失败重运行:  pytest --reruns 2 --reruns-delay 2 --html=report/test.html --self-contained-html

      生成xml格式报告:  pytest --reruns 2 --reruns-delay 2 --html=report/test.html --junitxml=path --self-contained-html

      生成日志格式报告:    pytest --reruns 2 --reruns-delay 2 --html=report/test.html --junitxml=path --resultlog=reportlog.txt --self-contained-html  

    示例1(不加 --self-contained-html):

    pytest.main(['-s', '-q', '--reruns=2', '--reruns-delay=2', '--html=./report/report.html',  'test_demo_13_assert.py'])  

    运行后生成带css的报告:

     示例2(html报告和CSS合并,独立显示):

    pytest.main(['-s', '-q', '--reruns=2', '--reruns-delay=2', '--html=./report/report.html', '--self-contained-html', 'test_demo_13_assert.py'])  

    运行后独立显示:

    报告详情(duration持续时间,接口测试时可以分析接口响应时间)

  • 相关阅读:
    绑定源特性的行为
    理解IOC和DI
    相遇~~~~
    选美素数~~~~~~~(⊙o⊙)
    狐狸找兔纸
    多重背包Q
    最长升序子序列
    构造逆序数
    田径赛马
    01背包M
  • 原文地址:https://www.cnblogs.com/xiaohuboke/p/13569358.html
Copyright © 2011-2022 走看看