关于Allure

Allure是一个report框架,可以基于一些测试框架生成测试报告,比较常用的一般是Junit/Testng框架;

Allure 生成的报告样式简洁美观,同时又支持中文;

Allure还支持使用Jenkins工具持续集成,整套环境搭建下来以后,使用起来非常方便。

分析测试的整体趋势

实现自动化测试用例与手动测试用例关联

下载allure

https://dl.bintray.com/qameta/generic/io/qameta/allure/allure/2.7.0/allure-2.7.0.zip

并配置环境变量

详情参考:https://www.jianshu.com/p/5735d388faa2

官网:

http://allure.qatools.ru/

下载:pip install allure-pytest

使用

pytest --alluredir=/tmp/my_allure_results

pytest test_baidu.py --alluredir ./result1

生成报告:allure serve /tmp/my_allure_results

Allure特性

pytest test_baidu.py --alluredir ./result1 --allure-features "搜索类"

import allure

@allure.feature("搜索类")
class TestSearchDemo:
@allure.story("搜索 英文")
def test_search(self):
print("这是一个搜索测试 英文") @allure.story("搜索 中文")
def test_search1(self):
print("这是一个搜索测试1 中文") @allure.story("搜索 特殊字符")
def test_search2(self):
print("这是一个搜索测试2 特殊字符")

清除之前的记录: --clean-alluredir

添加图片,html代码块,视频

import allure
import pytest @allure.feature("搜索类")
class TestSearchDemo:
@allure.story("搜索 英文")
#关键字驱动
@pytest.mark.parametrize("searchkey",[
"android","连衣裙","$#2!"
])
def test_search(self,searchkey):
with allure.step("第1步"):
print("第一步:打开搜索页面")
with allure.step("第2步"):
print("第二步:点击搜索框")
with allure.step("第3步"):
print(f"第三步:输入搜索词:{searchkey}") @allure.story("搜索 中文")
def test_search1(self):
print("这是一个搜索测试1 中文") @allure.story("搜索 特殊字符")
def test_search2(self):
print("这是一个搜索测试2 特殊字符") @allure.feature("登录类")
class TestLoginDemo:
def test_login1(self):
#插入图片
allure.attach('<img class="s_lg_img_gold_show" src="//www.baidu.com/img/flexible/logo/pc/result.png" alt="到百度首页" title="到百度首页">',
attachment_type=allure.attachment_type.HTML)
#插入本地图片
allure.attach.file('/Users/ADMIN/Desktop/a8d5a467242709a8c3a49a336abae8cd_1.PNG',
attachment_type=allure.attachment_type.PNG)
# 插入本地视频 allure.attach.file allure.attachment_type.MP4
print("login1") def test_login2(self):
print("login2") def test_login3(self):
print("login3")

Allure测试框架 python的更多相关文章

  1. XUnit测试框架-Python unittest

    选择 语言选择 本次个人作业我选择的语言是Python,了解学习Python有一段时间了但是一直没有练习,所以这次玩蛇,使用的版本是Python3.6. 开发工具选择 我选择的IDE是Pycharm, ...

  2. pytest+allure测试框架搭建

    https://blog.csdn.net/wust_lh/article/details/86685912 https://www.jianshu.com/p/9673b2aeb0d3 定制化展示数 ...

  3. Python接口测试实战3(下)- unittest测试框架

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

  4. 全功能Python测试框架:pytest

    python通用测试框架大多数人用的是unittest+HTMLTestRunner,这段时间看到了pytest文档,发现这个框架和丰富的plugins很好用,所以来学习下pytest.   imag ...

  5. [转]Python测试框架对比----unittest, pytest, nose, robot framework对比

      测试框架 什么是框架? 框架(Framework)是整个或部分系统的可重用设计,框架是用来解决代码的组织及运行控制问题的. 在我们编写自动化脚本的时候,经常需要读取配置文件,读取数据文件,发送请求 ...

  6. Python测试框架对比

    如有任何学习问题,可以添加作者微信:lockingfree 更多学习资料请加QQ群: 822601020获取 unittest, pytest, nose, robot framework对比 什么是 ...

  7. Pytest测试框架(五):pytest + allure生成测试报告

    Allure 是一款轻量级.支持多语言的开源自动化测试报告生成框架,由Java语言开发,可以集成到 Jenkins. pytest 测试框架支持Allure 报告生成. pytest也可以生成juni ...

  8. 某互联网后台自动化组合测试框架RF+Sikuli+Python脚本

    某互联网后台自动化组合测试框架RF+Sikuli+Python脚本 http://www.jianshu.com/p/b3e204c8651a 字数949 阅读323 评论1 喜欢0 一.**Robo ...

  9. Python几种常用的测试框架

    一.测试的常用规则 一个测试单元必须关注一个很小的功能函数,证明它是正确的: 每个测试单元必须是完全独立的,必须能单独运行.这样意味着每一个测试方法必须重新加载数据,执行完毕后做一些清理工作.通常通过 ...

随机推荐

  1. 【Azure 应用服务】Azure Web App的服务(基于Windows 操作系统部署)在被安全漏洞扫描时发现了TCP timestamps漏洞

    问题背景 什么是TCP timestamps(TCP 时间戳)? The remote host implements TCP Timestamps, as defined by RFC1323 (h ...

  2. 【UG二次开发】获取对象类型 UF_OBJ_ask_type_and_subtype

    代码: int type=0, subtype=0; UF_OBJ_ask_type_and_subtype(objTag, &type, &subtype);

  3. 理解Spring:IOC的原理及手动实现

    Spring是一个分层的JavaSE/EE full-stack(一站式) 轻量级开源框架.也是几乎所有Java工作者必须要掌握的框架之一,其优秀的设计思想以及其代码实现上的艺术也是我们需要掌握的. ...

  4. 孟老板 Paging3 (二) 结合Room

    BaseAdapter系列 ListAdapter系列 Paging3 (一) 入门 Paging3 (二) 结合 Room Paging3 (二)  结合Room Paging 数据源不开放, 无法 ...

  5. PRVF-0002: could not retrieve local nodename报错解决

     

  6. 每日三道面试题,通往自由的道路4——JVM篇

    茫茫人海千千万万,感谢这一秒你看到这里.希望我的面试题系列能对你的有所帮助!共勉! 愿你在未来的日子,保持热爱,奔赴山海! 每日三道面试题,成就更好自我 昨天既然你有讲到字符串常量池是吧,那这样吧 1 ...

  7. Spring Boot Docker

    1.  IDEA中配置Docker Docker默认只接受本地客户端的请求,为了能够远程访问它,首先要开放Docker的监听端口,运行外部应用可以访问 修改 /lib/systemd/system/d ...

  8. 在Excel中当遇到多个对象的目标值都不同时,如何快速设置条件格式突出未达标的对象

    1.选择实际值的一个单元格,选择条件格式,新建规则,选择图中选项. 2.这里选择大于,然后选择对比的单元格.选择需要的格式确定.(因为要对比的目标值不同,所以需要给单元格去掉绝对引用,也就是$符号). ...

  9. Unity的AnimationCurve

    转自:风宇冲Unity3D教程学院http://blog.sina.com.cn/s/blog_471132920101f8nv.html,本文有多处增删减改,详细内容请查看原文. 1.介绍 Anim ...

  10. Redis之集群

    Redis Cluster是 Redis的分布式解决方案,在3.0版本正式推出,有效地解决了Redis分布式方面的需求.当遇到单机内存.并发.流量等瓶颈时,可以采用Cluster架构方案达到负载均衡的 ...