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

相关推荐
11路没有终点1 天前
Pytest 安装、版本与第一个测试用例
测试用例·pytest
11路没有终点2 天前
pytest 参数化与 Mark 标记
pytest
2601_962296283 天前
五种Python自动化测试框架汇总,附学习方法
自动化测试·pytest·unittest·robotframework·python框架
11路没有终点3 天前
pytest Fixture 进阶:conftest 与依赖注入
pytest
2601_962387826 天前
web自动化测试实战教程【selenium/unittest/pytest】【共193课
selenium·pytest·devops·web自动化测试·unittest
weixin_440730506 天前
使用pytest中方法控制执行步骤(test_begin.py、test_end.py,@pytest.mark.run(order=1))
开发语言·python·pytest
2601_962297256 天前
Python、Pytest、Allure、Selenium和Jenkins实现自动化测试集成实例
python·selenium·jenkins·pytest·allure
2601_962077607 天前
从零搭建Python接口自动化测试框架:pytest+requests实战指南
python·pytest·接口自动化·requests·框架搭建
weixin_440730508 天前
pytest结合allure生成html测试报告(step、story、severity、screenshot)
前端·html·pytest·allure报告
拜托多多指教8 天前
【Pytest框架学习】分层架构
python·pytest