【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切换为中文

相关推荐
鲜于言悠9051 天前
博客系统测试报告
python·功能测试·selenium·jmeter·测试用例·集成测试·pytest
0和1的舞者2 天前
高并发论坛系统:单元测试 + 接口自动化 + 性能测试 + CI/CD 全链路测试报告
java·测试开发·测试工具·jmeter·pytest·测试·测试报告
独断万古他化2 天前
Python+Pytest 搭建博客系统接口自动化测试框架(全用例执行+完整代码)
pytest·接口自动化·测试·allure·requests
王夏奇2 天前
python-pytest学习
python·学习·pytest
独断万古他化3 天前
Python 接口测试之 requests 库核心用法
python·pytest·接口测试·requests
姚青&4 天前
Pytest 测试用例生命周期管理-fixture
测试用例·pytest
姚青&17 天前
PyCharm 配置与界面化运行
pytest
姚青&17 天前
Pytest 测试用例断言
测试用例·pytest
姚青&17 天前
Pytest 命名规则
pytest
姚青&17 天前
Pytest 测试用例结构
测试用例·pytest