pytest——测试报告pytest-testreport

安装插件

pip install pytest-testreport

注意点:如果安装了pytest-html这个插件请先卸载,不然有可能会有冲突。

使用介绍

在使用pytest运行测试时,如果要使用pytest-testreport生成测试报告, 运行测试时加上参数--report 指定报告文件名,即可实现。

其他运行参数:

--title :指定报告标题

--tester :指定报告中的测试者

--desc :指定报告中的项目描述

--template :指定报告模板样式(1 or 2)

命令行执行

pytest --report=musen.html --title=测试报告 --tester=木森 --desc=项目描述 --template=2

代码中使用pytest.main执行

import pytest  

pytest.main(['--report=musen.html',

                    '--title=测试报告',

                    '--tester=测试员',

                    '--desc=报告描述信息',

                    '--template=2'])

生成的报告样式如下

样式一

样式二

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。