pytest单元测试和生成allure测试报告

安装pytest

pytest单元测试和生成allure测试报告

; 新建文件test_01.py文件

pytest单元测试和生成allure测试报告
pytest单元测试和生成allure测试报告

安装pytest-html

pytest单元测试和生成allure测试报告

; 生成一个测试报告

pytest单元测试和生成allure测试报告
pytest单元测试和生成allure测试报告

用浏览器打开

pytest单元测试和生成allure测试报告
选择固定执行那个测试用例里面的内容
-x:出现一条测试用例失败就退出测试
-v:输出更详细的用例执行信息
-s:显示print内容
-q:简化结果信息,不会显示每个用例的文件名
pytest单元测试和生成allure测试报告
跳过该用例使用@pytest.mark.skip()
pytest单元测试和生成allure测试报告

; 测试开发代码,首先把代码复制过来

pytest单元测试和生成allure测试报告

然后使用pytest进行单元测试

pytest单元测试和生成allure测试报告

; pytest读取csv文件,创建一个csv文件

pytest单元测试和生成allure测试报告

pytest单元测试和生成allure测试报告

pytest单元测试和生成allure测试报告

; 使用pytest读取xml文件 创建xml文件

pytest单元测试和生成allure测试报告

pytest单元测试和生成allure测试报告

pytest单元测试和生成allure测试报告

; 使用allure生成测试报告

首先安装allure

pytest单元测试和生成allure测试报告

; 生成一个json格式测试报告

pytest单元测试和生成allure测试报告
pytest单元测试和生成allure测试报告

生成html测试报告

pytest单元测试和生成allure测试报告

Original: https://blog.csdn.net/weixin_47397805/article/details/113913905
Author: 斩·侯
Title: pytest单元测试和生成allure测试报告

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/776268/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球