pytest-html报告

1、打开cmd,cd到需要执行pytest用例的目录,执行指令:pytest --html=report.html

2、指定报告的path

执行指令: pytest --html=./report/report.html   #相对路径,也可指定绝对路径

报告独立显示

上面方法生成的报告,css是独立的,分享报告的时候样式会丢失,为了更好的分享发邮件展示报告,可以把css样式合并到html里:

pytest --html=report.html --self-contained-html

猜你喜欢

转载自www.cnblogs.com/jodie2019/p/13205573.html