关于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. Redis 性能问题分析

    在一些网络服务的系统中,Redis 的性能,可能是比 MySQL 等硬盘数据库的性能更重要的课题.比如微博,把热点微博[1],最新的用户关系,都存储在 Redis 中,大量的查询击中 Redis,而不 ...

  2. ANDROID开发 Fatal signal 11(SIGSEGV) at 0x问题解决方案

    最近做ANDROID开发,也遇到了很多程序员遇到的一个问题:FATAL SIGNAL 11(SIGSEGV) at 0xxxxx,自然是各种搜索是否有人已然解决,虽然搜索出来的已有案例不少,基本都是内 ...

  3. ffmpeg入门到实战-ffmpeg是怎么转码的?

    阅读目录 视频是怎么被播放的? ffmpeg命令的格式 ffmpeg转码输出的过程 视频是怎么被播放的? 我们知道,当下大多数播放器都是基于ffmpeg二次开发的.你有没有想过,你用播放器打开一个视频 ...

  4. SpringAnimator弹簧联动效果的实现

    使用SpringAnimation实现弹簧联动 简介 弹簧效果动画SpringAnimation与甩动效果动画FlingAnimation使用上很类似,主要区别在于FlingAnimation是根据甩 ...

  5. Dagger2入门,以初学者角度

    2016-12-21 更新:添加@Subcomponent注解以及Lazy与Provider的使用,本文基本完结!如果有好的建议请提出,感谢大家的支持,谢谢 依赖注入 Dagger2是Android中 ...

  6. unity中的文件存储路径与各平台(Android,iOS)的关系

    原文链接:unity中的文件存储路径与各平台(Android,iOS)的关系 主要是这个问题困扰我了一阵子,所以特写写... unity中的的各种存储方法的对应关系(直接上截图吧) 重点说的是Appl ...

  7. zabbix_manage的使用

    实验环境: zabbix server 172.16.1.121 访问端 172.16.1.122 55.1 说明 zabbix_manager是zabbix终端管理工具,可以在linux终端实现管理 ...

  8. 19、高可用工具heartbeat介绍

    19.1.heartbeat的作用: heartbeat的官方网站地址是:http://linux-ha.org/wiki/Main_Page 19.2.heartbeat工作原理: 19.3.hea ...

  9. API安全综述

    API安全综述 译自:An Overview on API Security. 本文概括了API防护有关的方方面面,从上层视角介绍了API防护中主要注意的点,并给出了相应的建议.本文可以作为一个API ...

  10. 1、springboot2新建web项目

    1.添加依赖 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http ...