python中生成allure报告的方法

python中生成allure报告的方法

小编给大家分享一下python中生成allure报告的方法,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!

一、安装pytest

pytest是python的一个第三方单元测试框架,在这里用于生成原始的执行结果。

非常方便和易用。可以规模化以及编写更加复杂的测试用例。

pip install pytest

二、安装allure-pytest

allure-pytestpython的一个第三方库。用于连接pytestallure,使它们可以配合在一起使用。

allure-pytest基于pytest的原始执行结果生成适用于allure的json格式结果。该json格式结果可以用于后续适用allure生成html结果。

pip install allure-pytest

三、安装allure-commandline

此工具是用于命令行生成allure报告的工具,官方下载链接:https://bintray.com/qameta/generic/allure2

四、allure生成测试报告

1、生成xml文件

pytest 测试文件所在路径 --alluredir 生成的测试结果数据保存的目录

pytest --alluredir=resport/xml/ D:/PyTest/tests/allure/test_allure_demo.py1

2、生成html文件

allure generate 测试结果数据所在目录 -o 测试报告保存的目录 --clean

allure generate D:/PyTest/tests/allure/report/xml -o D:/PyTest/tests/allure/report/html --clean1

3、allure生成测试报告

数据所在目录 -o 测试报告保存的目录 --clean

allure generate D:/PyTest/tests/allure/report/xml -o D:/PyTest/tests/allure/report/html --clean1

看完了这篇文章,相信你对python中生成allure报告的方法有了一定的了解,想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!