pytest生成测试报告
发布时间:2020-12-14 14:48:17 所属栏目:百科 来源:网络整理
导读:pip安装 pip install pytest-html 编写脚本 import pytest class TestClass(object): def test_one(self): x = " this " assert ' h ' in x test_two(self): x = hello in x 运行程序: pytest --html=report.html 结果: C:UsershaiyDesktopcodeiot_yj
pip安装pip install pytest-html
编写脚本import pytest class TestClass(object): def test_one(self): x = "this" assert 'h' in x test_two(self): x = helloin x 运行程序:pytest --html=report.html 结果: C:UsershaiyDesktopcodeiot_yjb_api λ pytest --html=report.html ============================ test session starts ============================= platform win32 -- Python 3.7.1rc1,pytest-5.3.5,py-1.8.1,pluggy-0.13.1 rootdir: C:UsershaiyDesktopcodeiot_yjb_api plugins: html-2.0.0 collected 2 items test_api.py .. [100%] - generated html file: file://C:UsershaiyDesktopcodeiot_yjb_apireport.html - ============================= 2 passed in 0.07s ============================ 在当前目录生成一个report.html测试报告文件打开如下 ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |