pytest + allure 生成测试报告
pytest测试样例规则:
测试文件以test_开头(以_test结尾也可以)
测试类以Test开头,并且不能带有 init 方法
测试函数以test_开头
断言使用基本的assert即可
ubuntu 安装allure
sudo apt-add-repository ppa:qameta/allure
sudo apt-get update
sudo apt-get install allure
mac安装allure:
brew install allure
源码安装参考地址:
https://bintray.com/qameta/generic/allure2
安装pytest以及allure包:
pip3 install pytest
#不使用这个pip3 install pytest-allure-adaptor,用下面那个
pip3 install allure-pytest
创建一个用例
test_one.py:
class TestClassOne(object):
def test_one(self):
x = "this"
assert 't'in x
def test_two(self):
x = "hello"
assert hasattr(x, 'check') class TestClassTwo(object):
def test_one(self):
x = "iphone"
assert 'p'in x
def test_two(self):
x = "apple"
assert hasattr(x, 'check')
#执行所有用例文件
pytest --alluredir=report
allure generate report
#执行指定用例文件
pytest -s -q --alluredir=report test_one.py
allure generate report
覆盖生成报告
#allure generate report --clean
#生成到指定文件夹
allure generate report -o html
执行完testcase后,生成报告,模版在 allure-report 中,将index.html在服务器环境中打开。
默认情况下,report目录中的json文件是累加的,不会清除,如果需要重新跑一遍用例,那么应该先清空report文件夹,再执行上面的命令,即可显示本次执行结果。
pytest + allure 生成测试报告的更多相关文章
- Pytest测试框架(五):pytest + allure生成测试报告
Allure 是一款轻量级.支持多语言的开源自动化测试报告生成框架,由Java语言开发,可以集成到 Jenkins. pytest 测试框架支持Allure 报告生成. pytest也可以生成juni ...
- python + pytest + allure生成测试报告
pytest结合allure生成测试报告 环境搭建 要安装java环境,版本要是jdk1.8的,配置好java环境变量,不然输入allure命令会报错,JAVA_HOME环境,自行配置 安装allur ...
- Pytest+allure生成测试报告
1.Allure.zip包的下载地址: https://github.com/allure-framework/allure2 在跳转页面选择一个allure.zip包的版本下载 若以上方法无法下载z ...
- pytest(11)-Allure生成测试报告(一)
Allure是一个开源的测试报告生成框架,提供了测试报告定制化功能,相较于我们之前使用过pytest-html插件生成的html格式的测试报告,通过Allure生成的报告更加规范.清晰.美观. pyt ...
- Python单元测试框架之pytest 2 -- 生成测试报告
From: https://www.cnblogs.com/fnng/p/4768239.html Python单元测试框架之pytest -- 生成测试报告 2015-08-29 00:40 by ...
- pytest+allure生成接口自动化测试报告
准备环境 1.安装pytest pip install pytest -i http://pypi.douban.com/simple pytest-ordering pytest.main([ &q ...
- python自动化之使用allure生成测试报告
Allure测试报告框架帮助你轻松实现"高大上"报告展示.本文通过示例演示如何从0到1集成Allure测试框架.重点展示了如何将Allure集成到已有的自动化测试工程中.以及如何实 ...
- 【Mac+Wind7】pytest + allure生成定制报告
一.升级Powershell(windows7及以上版本默认自带.其实普通的CMD命令行工具够用了) 我是Win7默认带的pw1.0,太古老了升级一下,地址如下,选择与自己windows版本匹配的连接 ...
- pytest allure 生成html测试报告
前提:需要 java 1.8 以上.python3环境 一.下载pytest pip install pytest 二.下载Allure Pytest Adaptor插件 pip install py ...
随机推荐
- C++:构造函数
问题提出 默认初始化 答案 ▶问题提出 主要是在VC++ 2015里经常提示莫名其妙的编译错误. 分析一下,为什么Java里构造函数这个问题很简单: 1. C++里对象类型不止有按引用传递,还可能拷贝 ...
- C# MemcacheHelper封装
using Memcached.ClientLibrary; using System; using System.Collections.Generic; using System.Linq; us ...
- elementUI一次请求上传多个文件
elementui <el-upload class="upload-demo" ac ...
- JavaScript 事件(基础)
一.事件 事件:触发-响应机制. 二.事件三要素 1.事件源:触发事件的元素 2.事件名称:发送了什么方式的事件 3.事件处理程序:事件触发后要执行的代码(函数形式) 三.事件的使用方式 1.获取元素 ...
- mybatis的一级缓存与二级缓存
一级缓存 Mybatis一级缓存的作用域是同一个SqlSession,在同一个sqlSession中两次执行相同的sql语句,第一次执行完毕会将数据库中查询的数据写到缓存(内存),第二次会从缓存中 ...
- Android Handler类 发送消息-post()和postDelay(), Looper讲解
https://blog.csdn.net/weixin_41101173/article/details/79701832 首先,post和postDelay都是Handler的方法,用以在子线程中 ...
- Java垃圾回收_过程观察
这是今天看JVM垃圾回收的时候做的实验观察. 使用工具:Java VisualVM.VisualVM GC插件 观察应用:Tomcat容器中的Web服务 1. Java VisualVM 在tomca ...
- 对Sql Server执行计划的浅显了解。
一名大三的小学生,今天开始我的第一篇博客,最近随便做了一个简易的酒店管理系统,对sql执行计划有了初步的了解. 查看上面语句的预估执行计划,在工具栏中有这个按钮 聚集索引扫描被称为Index Scan ...
- Top命令数据分析
一.top命令详解 当前时间 20:27:12 当前系统运行时间 3:18秒 1个用户 系统负载平均长度为 0.00,0.00,0.00(分别为1分钟.5分钟.15分钟前到现在的平均值) 第二行为进程 ...
- Ubuntu 18.04 + Gtx 1660 安装Nvidia 显卡驱动
1.UEFI禁用secure boot(我的系统是win10主系统,引导ubuntu,安装驱动前电脑存在win10 uefi引导问题) Make sure the "OS Type" ...