温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

python中生成allure报告的方法

发布时间:2020-12-08 14:52:20 来源:亿速云 阅读:686 作者:小新 栏目:编程语言

小编给大家分享一下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报告的方法有了一定的了解,想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI