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

相关推荐
我的xiaodoujiao10 小时前
API 接口自动化测试详细图文教程学习系列9--Requests模块
python·学习·测试工具·pytest
我的xiaodoujiao11 小时前
API 接口自动化测试详细图文教程学习系列10--Requests模块2--举例说明
python·学习·测试工具·pytest
超梦梦梦梦2 天前
playwright&pytest
pytest
不明觉厉二十年5 天前
pytest+pywinauto+pycharm制作mobaxterm 字符串快捷发送器 Demo
ide·pycharm·pytest
春日见7 天前
TEST文件夹:Pytest,集成测试,单元测试
服务器·人工智能·驱动开发·单元测试·计算机外设·集成测试·pytest
TRACER~857 天前
项目实战:pandas+pytest+allure+adb
adb·pandas·pytest
Franciz小测测8 天前
Pytest 并发分组执行引擎(支持UI / 接口自动化测试):从设计到工程落地
pytest
小猪咪piggy8 天前
【接口自动化】(2) pytest 测试框架
运维·自动化·pytest
忘忧记8 天前
Pytest + Requests + YAML 数据驱动+日志模块
网络·python·pytest
清水白石0089 天前
pytest Fixture 设计实战指南:作用域、依赖链、自动清理与测试资源高效复用
python·pytest