Allure报告
Allure介绍
Allure是一个独立的报告插件,生成美观易读的报告,目前支持语言:Java, PHP, Ruby, Python, Scala, C#。
Allure安装
1.安装pytest的插件包pytest-allure-adaptor: pip install allure-pytest
Allure帮助文档
https://docs.qameta.io/allure/#_about
生成Allure报告
命令行参数:pytest --alluredir report # 在执行命令目录生成report文件夹,文件夹下包含xml文件
pytest.ini
[pytest]
addopts = -s --alluredir report
# 测试路径
testpaths = ./Test
# 测试文件名
python_files = test_*.py
# 测试类名
python_classes = Test_*
# 测试的方法名
python_functions = test_*
test_all.py
class Test_allure:
def setup(self):
pass
def teardown(self):
pass
def test_al(self):
assert 0
操作步骤:
1.命令行进入pytest.ini所在目录
2.输入命令:pytest
执行结果:
1.pytest.ini所在目录生成report文件夹,文件夹下生成一个json文件