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 ...
随机推荐
- jsMind思维导图模式展示数据
效果图: jsmind组件下载地址:https://files.cnblogs.com/files/fengyeqingxiang/jsmind.zip 后端代码,此处以C#编写的后台,Java或其他 ...
- 关于Mysql datetime类型存储范围测试
创建一个datetime表 > create table date_time(time datetime); > desc date_time; +-------+----------+- ...
- 基于OpenGL三维软件开发
实验原理: OpenGL在MFC下编程原理---- Windows操作系统对OpenGL的支持 在Windows下用GDI作图必须通过设备上下文(DeviceContext简写DC)调用相应的函数:用 ...
- Resource注解无法导入依赖使用javax.annotation的注解类
Resource注解无法导入依赖使用javax.annotation的注解类 使用javax.annotation的注解类 javax.annotation.Resource 注解在eclipse中无 ...
- vue项目的各个文件作用
vue项目的各个文件作用: build:放置的是webpack配置文件,一般不动,修改了必须重启服务器才能生效 config:放置针对开发环境和线上环境的配置文件,一般不动 修改后需重启 node_m ...
- VsCode中编写python环境配置
1. VsCode中编写python环境配置 1.1. 前言 有过开发经验都知道idea一系列的软件虽然功能比较多,但比较容易卡,电脑不好还真容易上火,这里我想要入门python,还是选了款vscod ...
- vue element-ui tree 根节点固定子节点懒加载 首次加载根节点并展开
关键代码: <el-tree ref="foldTree" node-key="id" :highlight-current="true&quo ...
- fiddler模拟弱网测试
1.首先设置手机代理 设置手机代理到本机ip,端口号8888(Fiddler默认设置): 手机访问http://ip:port安装Fiddler证书 2.修改fiddler配置 勾选上后,已经开始限速 ...
- MySQL的JOIN连接
MySQL的JOIN join的含义跟英文单词"join"一样,连接连接两张表.分为 内连接:inner join 外连接 (1)左外连接(左边的表不加限制):left joi ...
- 百度云人脸识别API人脸库管理
from urllib import request import base64 import requests import re import json import urllib impor ...