Skip to main content

pytest-flexreport

1、介绍

pytest-flexreport是针对pytest的生成html报告的插件,自动收集用例执行的详细日志信息,以及相关错误和输出信息。 使用起来非常简单,安装好pytest-testreport之后,运行用例时加上参数即可生成报告

2、安装

pytest-testreport是基于python3.7+开发的,安装前请确认你的python版本>3.7

安装命令

pip install pytest-flexreport

3、快速开始

注意:如果安装了pytest-html这个插件,可能会有冲突,如果冲突则先卸载pytest-html
3.1 template介绍
  • --template=1:白底报告,以用例为维度,含详情
  • --template=2:蓝底报告,以用例为维度,含详情
  • --template=3:蓝底报告,结果概述,统计模块通过率(使用场景:邮件发送summary)
3.2 使用案例
  • 命令行执行: pytest 运行测试时加上参数--report 指定报告文件名
    # 指定报告文件名
    pytest --report=demo-report.html
    
    #其他配置参数
    --template=3, 测试报告模板选择(1,2,3)
    --report=/*/*.html, 报告生成绝对路径
    --history_dir=history.json的目录路径,默认使用html文件同级目录
    --title=测试报告标题, 回填到报告
    --tester=测试人员,回填到报告
    --desc=测试构建描述,回填到报告
    --log_path=测试日志路径, 回填到报告(template=3)
    --report_path=测试报告详情路径, 回填到报告(template=3)
    --testcase_basename=测试用例root-dir basename, 供遍历__init__.py查找模块名(template=3)
    
    # 同时使用多个参数
    pytest --report=report.html --history_dir=./reports --title=测试报告 --tester=txu --desc=项目描述
    
  • pytest.main执行
    import pytest
    
    pytest.main(['--report=demo-report.html',
                 '--history_dir=./reports',
                 '--title=测试报告标题',
                 '--tester=txu',
                 '--desc=报告描述信息'])
    

Release files for pytest-flexreport 1.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-flexreport 1.2.7
File Size Uploaded
pytest_flexreport-1.2.7.tar.gz 478.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-flexreport 1.2.7
File Interpreter ABI Platform
pytest_flexreport-1.2.7-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 959.1 kB

Release files / pytest_flexreport-1.2.7.tar.gz

Download URL pytest_flexreport-1.2.7.tar.gz
Size 478.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f6c501171761d523e08f4723aa517d2683030d070f3ed60626b14b29aa36df3a
BLAKE2b-256 checksum
How to use checksums
ab25c544b877cba3a042c43289cfe7f57f0fd62be71815aea063401db8a61398
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release files / pytest_flexreport-1.2.7-py2.py3-none-any.whl

Download URL pytest_flexreport-1.2.7-py2.py3-none-any.whl
Size 480.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
275bc3b3623c1f0e747b17c438ae6ba24590c0f380f894102c167acc4a198dec
BLAKE2b-256 checksum
How to use checksums
f463e4e06a8a73f11bf14bead02d3dc12e442e1fdda138595c8ca692aea83d8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

1.2.7 This release

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.1.17

1 release file

1.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page