【Pytest篇】pytest生成报告的几种方式

使用Pytest生成测试报告的几种方式

1.生成Junitxml文件,可供后续jenkins持续集成使用

在cmd 命令行中执行如下命令

pytest test_login_dlz.py --junit-xml=../report/log01.xml

生成的xml报告如下

2.生成在线测试报告,方便提供给其他人查看下载

pytest test_login_dlz.py --pastebin=all

3.生成html报告

先进行库安装

pip install pytest-html

运行方式1:直接在cmd中运行

 运行方式2:在脚本中运行

if __name__ == '__main__':
    pytest.main(['test_login_dlz.py', '--html=../report/report.html'])

生成报告如下

Supongo que te gusta

Origin blog.csdn.net/weixin_46361114/article/details/120613958
Recomendado
Clasificación