【pytest】 allure 生成报告

1. 下载地址

官方文档;

Allure Framework

参考文档: 最全的Pytest+Allure使用教程,建议收藏 - 知乎

https://github.com/allure-framework

1.2安装Python依赖

windows:pip install allure-pytest

2. 脚本

用例

import pytest
class Test_Smoke:
    def test_01(self):
        assert 1+1==2
    @pytest.mark.smoke
    def test_02(self):
        assert 1+2==1

    @pytest.mark.smoke
    def test_03(self):
        assert 1 + 2 == 3

import pytest

if __name__=='__main__':
    print("hhhhhhh")
    

    pytest.main(['-s', '-v', '-m smoke', './somke_test','--alluredir=./report/allure', '--html=./report/result.html'])

清空历史数据'--clean-alluredir'

#    清空历史数据'--clean-alluredir'
pytest.main(['-s', '-v', '-m smoke', './somke_test','--clean-alluredir', '--alluredir=./report/allure', '--html=./report/result.html'])

管理员打开 pycharm 运行

3.显示报告

3.1添加环境变量

3.2查看报告使用:allure serve 目录

3.3切换为中文

相关推荐
XXX-1720 小时前
1.pytest基础知识(默认的测试用例的规则以及基础应用)
软件测试·pytest
Mavis先生2 天前
PyTest装饰器
pytest
神即道 道法自然 如来5 天前
Python+Pytest框架,“main_run.py文件怎么编写“?
java·python·pytest
___Dream5 天前
【项目一】基于pytest的自动化测试框架———解读requests模块
python·计算机网络·pytest
ccy加油呀7 天前
pytest 接口测试
android·pytest
云泽野9 天前
一篇文章了解Pytest单元测试框架
服务器·单元测试·pytest
___Dream10 天前
【项目一】基于pytest的自动化测试框架day1
pytest
这不巧了10 天前
Faker在pytest中的应用
python·自动化·pytest
测试界的海飞丝11 天前
pytest运行方式及前置后置封装详解
开发语言·selenium·单元测试·pytest
什么时候才能变强11 天前
Pytest-@pytest.fixture夹具篇(一)
pytest