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持续时间,接口测试时可以分析接口响应时间)

  • 相关阅读:
    第一个win8应用的制作过程
    win8开发-Xaml学习笔记一
    梦想成为“老板”的第二天
    梦想成为“老板”的第一天
    HTTP请求
    linux常用命令
    HTML中常用的标签
    HTML基本结构
    记录Django的settings文件常用配置
    Oracle数据泵expdp、impdp
  • 原文地址:https://www.cnblogs.com/xiaohuboke/p/13569358.html
Copyright © 2011-2022 走看看