首页 > Web开发 > 详细

pytest入门到放弃20--HTML报告

时间:2020-08-27 11:15:58      阅读:89      评论:0      收藏:0      [点我收藏+]

插件: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

 

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

技术分享图片

 

pytest入门到放弃20--HTML报告

原文:https://www.cnblogs.com/xiaohuboke/p/13569358.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!