详细见此篇博客:https://www.cnblogs.com/yoyoketang/p/12203778.html
allure的几种方法:
allure用例描述
使用方法 参数值 参数说明
@allure.epic() epic描述 敏捷里面的概念,定义史诗,往下是feature
@allure.feature() 模块名称 功能点的描述,往下是story
@allure.story() 用户故事 用户故事,往下是title
@allure.title(用例的标题) 用例的标题 重命名html报告名称
@allure.testcase() 测试用例的链接地址 对应功能测试用例系统里面的case
@allure.issue() 缺陷 对应缺陷管理系统里面的链接
@allure.description() 用例描述 测试用例的描述
@allure.step() 操作步骤 测试用例的步骤
@allure.severity() 用例等级 blocker,critical,normal,minor,trivial
@allure.link() 链接 定义一个链接,在测试报告展现
@allure.attachment() 附件 报告添加附件

例如:

生成的报告如下:

因此层级结构为:epic—>feature—>story—>title

当我们最终执行用例的时候,是在jenkins上构建job执行测试用例,即Gitlab-->jenkins-->job
什么时候执行(回归、冒烟测试)
一般流程:新的代码(版本)提交-->部署接口-->构建job--》冒烟/回归测试报告--》邮件通过
pytest allure的安装豆瓣地址
pip install pytest==5.4.3 --index-url https://pypi.douban.com/simple
pip install allure-pytest==2.8.6 --index-url https://pypi.douban.com/simple
allure是一个命令行工具,需要去github 上下载最新版https://github.com/allure-framework/allure2/releases
# pytest --alluredir=./report/allure --allure-severities=normal
import allure
@allure.epic("OA系统测试接口")
@allure.feature("测试模块1")
class Test():@allure.severity('normal') # 用例等级# @allure.title('新增单据')@allure.issue('http://www.baidu.com')@allure.story('新增单据')@allure.step('新增')def test_01(self):print('新增')@allure.story('新增单据')@allure.step('保存')def test_02(self):print('保存')

1、执行以下命令输出allure报告

pytest --alluredir ./report/allure_raw 指定测试报告存放路径
./report/allure_raw当前目录下report文件下的report/allure_raw


D:\code\py_dev_test\pytest框架\pytest_base\allure报告>pytest --alluredir ./report/allu
re_raw
================================ test session starts ================================
platform win32 -- Python 3.6.0, pytest-4.5.0, py-1.8.0, pluggy-0.13.1
rootdir: D:\code\py_dev_test\pytest框架\pytest_base\allure报告, inifile: pytest.ini
plugins: allure-pytest-2.8.6, base-url-1.4.2, html-1.19.0, metadata-1.8.0
collected 2 items                                                                    test_allure.py ..                                                              [100%]============================= 2 passed in 0.42 seconds ==============================

即生成一个原始文件的报告

2、执行以下命令生成可视化页面报告

allure serve report/allure_raw

D:\code\py_dev_test\pytest框架\pytest_base\allure报告>allure serve report/allure_raw
Generating report to temp directory...
report\allure_rawlure_raw does not exists
Report successfully generated to C:\Users\ADMINI~1\AppData\Local\Temp\9181726724528405
272\allure-report
Starting web server...
2021-08-31 21:52:17.536:INFO::main: Logging initialized @9647ms to org.eclipse.jetty.u
til.log.StdErrLog
Server started at <http://192.168.1.101:58436/>. Press <Ctrl+C> to exit

打开上面的地址即可看到报告详情

3、allure命令行参数

  • 根据epic属性执行用例:

pytest --alluredir ./report/allure --allure-epics=OA系统测试接口

D:\code\py_dev_test\pytest框架\pytest_base\allure报告>pytest --alluredir ./report/allure --allure-epics=OA系统测试接口
===================================================== test session starts ======================================================
platform win32 -- Python 3.6.0, pytest-4.5.0, py-1.8.0, pluggy-0.13.1
rootdir: D:\code\py_dev_test\pytest框架\pytest_base\allure报告, inifile: pytest.ini
plugins: allure-pytest-2.8.6, base-url-1.4.2, html-1.19.0, metadata-1.8.0
collected 2 items                                                                                                               test_allure.py ..                                                                                                         [100%]=================================================== 2 passed in 0.33 seconds ===================================================

根据featires执行:pytest --alluredir ./report/allure --allure-features=测试模块1 (=号后面是features的名称)

D:\code\py_dev_test\pytest框架\pytest_base\allure报告>pytest --alluredir ./report/allure --allure-features=测试模块1
===================================================== test session starts ======================================================
platform win32 -- Python 3.6.0, pytest-4.5.0, py-1.8.0, pluggy-0.13.1
rootdir: D:\code\py_dev_test\pytest框架\pytest_base\allure报告, inifile: pytest.ini
plugins: allure-pytest-2.8.6, base-url-1.4.2, html-1.19.0, metadata-1.8.0
collected 2 items                                                                                                               test_allure.py ..                                                                                                         [100%]=================================================== 2 passed in 0.07 seconds ===================================================
  • 根据story执行用例:

pytest --alluredir ./report/allure --allure-stories=新增单据 (stories=story名称)

D:\code\py_dev_test\pytest框架\pytest_base\allure报告>pytest --alluredir ./report/allure --allure-stories=新增单据
===================================================== test session starts ======================================================
platform win32 -- Python 3.6.0, pytest-4.5.0, py-1.8.0, pluggy-0.13.1
rootdir: D:\code\py_dev_test\pytest框架\pytest_base\allure报告, inifile: pytest.ini
plugins: allure-pytest-2.8.6, base-url-1.4.2, html-1.19.0, metadata-1.8.0
collected 2 items                                                                                                               test_allure.py ..                                                                                                         [100%]=================================================== 2 passed in 0.12 seconds ===================================================
  • 根据用例等级执行用例:

pytest --alluredir ./report/allure --allure-severities=normal (normal 为等级)

allure中对等级划分为以下几个等级:
blocker:阻塞缺陷
critical:严重缺陷
normal:一般缺陷
minor:次要缺陷
trivial:轻微缺陷


执行:pytest --alluredir ./report/allure --allure-severities=normal

D:\code\py_dev_test\pytest框架\pytest_base\allure报告>pytest --alluredir ./report/allu
re --allure-severities=normal
================================ test session starts ================================
platform win32 -- Python 3.6.0, pytest-4.5.0, py-1.8.0, pluggy-0.13.1
rootdir: D:\code\py_dev_test\pytest框架\pytest_base\allure报告, inifile: pytest.ini
plugins: allure-pytest-2.8.6, base-url-1.4.2, html-1.19.0, metadata-1.8.0
collected 2 items                                                                    test_allure.py .                                                               [100%]============================= 1 passed in 0.08 seconds =========================
  • 在执行前清空之前已生成的报告:
    pytest --alluredir ./report/allure --clean-alluredir

我们可以将以上这些以pytest的命令加到配置文件中,执行的时候就会自动带上。如果有多个命令,中间以空格间隔开。

allure的安装使用以及报告的生成相关推荐

  1. allure的安装和使用(windows环境)

    在安装allure之前,先确认电脑已经安装了jdk1.8+ 1.下载allure allure的官网下载地址: https://github.com/allure-framework/allure2/ ...

  2. python生成ppt报告_python 生成 pptx 分析报告的工具包:reportgen

    reportgen v0.1.8 更新 这段时间,我对 reportgen 进行了大工程量的修改和更新.将之前在各个文章中出现的函数进行了封装,同时也对现有工具包的一些逻辑进行了调整. 1.repor ...

  3. Oracle AWR 报告的生成和分析

    1.背景 1.1.Linux 服务器情况 # cat /etc/issue Red Hat Enterprise Linux Server release 6.1 (Santiago) Kernel ...

  4. awr报告分析 mysql_AWR报告的生成和简单分析方法

    生成AWR报告方法: 第一步:数据库压力测试卡开始时:生成第一个快照: Sqlexec dbms_workload_repository.create_snapshot(); 第二步:数据库压力测试结 ...

  5. [安装项目]不可恢复的生成错误

    [安装项目]不可恢复的生成错误 今天在搞一个安装项目,编译的时候总是出来一个"不可恢复的生成错误",,于是我是翻山越顶啊,跋山涉水啊,终于找到了问题原来出自于C:\Program ...

  6. 在子域下安装Exchange服务器并批量生成用户为每一位用户建立邮箱

           在子域下安装 Exchange 服务器并批量生成用户为每一位用户建立邮箱 <?xml:namespace prefix = o ns = "urn:schemas-mic ...

  7. 安装配置Windows AIK之生成Windows PE

    安装配置Windows AIK之生成Windows PE 1. 概述 Windows? 自动安装工具包可帮助您安装.自定义和部署 Microsoft Windows? 7 和 Windows Serv ...

  8. ae2020不支持的视频驱动程序_AE 2020版本安装提示系统兼容性报告怎么解决?

    AE 2020版本安装提示系统兼容性报告怎么解决?很多设计师朋友会遇到这样的问题:安装完AE2020版本之后,打开软件,提示这样的信息显示系统兼容性报告可这样解决.快进来学习吧. 系统是WIN10的, ...

  9. matlab自动生成报告,一种基于MATLAB的Word报告自动生成方法

    总第 182期 一 种基于MATLAB的Word报告自动生成方法 孙 剑 (信阳农林学院,河南 信阳 464000) 摘要:自动生成Word文档报告功能是办公 自动化系统中的重要组成部分.为高效的完成 ...

  10. Ranorex中Reports报告不能生成

    1.重装Ranorex也不可以,重启也不行,新建工程的Reports报告也无法生成.不停刷新也没有,但是bin下的报告却能生成,但隔几分钟才能看到,我是打开360安全卫士,进行电脑体检.木马查杀.电脑 ...

最新文章

  1. htop 和 bashtop 的一些不足
  2. CF797E. Array Queries
  3. Win2003安装后的十个小技巧
  4. 体育场[带权并查集]
  5. tomcat java 参数乱码_javaweb乱码(tomcat服务器)
  6. mysql有3个共同好友_共同好友mysql
  7. android另类工具,[置顶] android应用程序开发另解及Android SDK工具集的另类用法
  8. linux c的内存映像
  9. 云图说|应用魔方AppCube:揭秘码农防脱神器
  10. Eclipse 取消import自动补全具体的类名
  11. 警告框(AlertView)与进度轮结合使用
  12. 用户画像数据建模方法
  13. 【回声状态网络ESN预测】基于粒子群优化回声状态网络ESN实现数据预测附matlab代码
  14. Java实验报告误差分析怎么写_系统工程实验报告-031510131-郭文豪.doc
  15. 需求调研中要注意的三点
  16. Winedt/CTeX/LaTeX编辑器显示行号
  17. (三)shp路网数据导入postgres中
  18. PTA 7-10 计算工资
  19. 硅谷之思:数据的永生
  20. Python制作植物大战僵尸,赶快来试试吧

热门文章

  1. 华为笔记本键盘说明图_笔记本电脑键盘各键名称与位置(最好有图)
  2. 俞敏洪:度过有意义的生命(转)
  3. iOS崩溃日志ips文件解析
  4. mac上html无法显示图片,Safari 无法显示/加载网页图片解决方案
  5. 怎样去掉gif动图水印?在线编辑gif图片技巧
  6. 多变量微积分笔记5——梯度与方向导数
  7. c语言输出字符太阳,〖作业〗 C语言程序设计
  8. 用74161设计十二进制计数器
  9. word流程图怎么做虚线框_word虚线框怎么打 word中目录虚线怎么打?
  10. 【010】Excel宏编程相关封装模块(字体设置、写入表格内容)_003_#VBA