您的位置:首页 > 科技 > 能源 > pytest +allure在测试中的应用

pytest +allure在测试中的应用

2024/10/5 14:05:29 来源:https://blog.csdn.net/qq_38889531/article/details/139355457  浏览:    关键词:pytest +allure在测试中的应用

一、allure配置:
1、安装allure库

pip install allure-pytest

2、代码中导入

import allure

3、常用命令:
1)、

pytest --alluredir=报告目录 测试脚本.py

比如:pytest --alluredir=./allure_report (未指定执行所有)
2)、生成报告

allure serve 报告的目录

4、代码中常用

@allure.feature("测试功能")
@allure.story("测试用例")
@allure.severity("严重程度")
@pytest.mark.parametrize("a, b, expected", [(1, 2, 3), (4, 5, 9)])
def test_addition(a, b, expected):with allure.step("执行加法操作"):result = a + bassert result == expected

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com