Pytest allure 生成测试报告
1、之前用到 Pytest 中的插件 --html 生成报告,今天我们看下 Pytest 结合 allure 的使用
import pytest import os class TestDemo(): def test_01(self): assert 1 == 1 def test_02(self): assert 1 == 0 def test_03(self): print("hello world") if __name__ == '__main__': pytest.main(["-s", "./test_demo1.py", "--alluredir=./result", "--clean-alluredir"]) """ --alluredir=./result --> 指定运行后生成 json 格式的结果文件目录 --clean-alluredir --> 指定每次运行后情况 json 文件目录,防止文件累积 """ os.system("allure generate ./result -c -o ./report") """ allure generate --> allure 生成报告的命令,固定写法 ./result --> 获取报告数据的 json 文件目录 -c --> 每次执行后清空报告目录 -o --> 输出报告命令 ./report --> 报告存放目录 """


作者:Evan0813
微信:ZhengYing8887
出处:https://www.cnblogs.com/ZhengYing0813/
备注:本文版权归作者所有,欢迎转载和添加作者微信探讨技术,但未经作者同意必须在文章页面给出原文链接,否则保留追究法律责任的权利。

浙公网安备 33010602011771号