pytest+allure测试框架搭建

https://blog.csdn.net/wust_lh/article/details/86685912

https://www.jianshu.com/p/9673b2aeb0d3

定制化展示数据

https://blog.csdn.net/qw943571775/article/details/99634577

 

环境说明:

jdk = 1.8

python = 3.5.3

allure-commandline = 2.13.0 

文档及下载地址:https://docs.qameta.io/allure/#_commandline

GitHub:https://github.com/allure-framework/allure2/releases

 

一、下载安装allure-commandline,配置环境变量

 

  1.1 下载合适版本 https://github.com/allure-framework/allure2/releases

    

 

 

 

  1.2 解压文件并将 bin目录添加到Path环境变量中

    

 

 

 

   1.3 验证allure

     输入allure --version,返回版本信息则安装成功

     

 

 

 

 二、安装pytest和pytest-allure

  pip install pytest

  pip install allure-pytest

  注意:网上大多数是安装pytest-allure-adaptor,这是allure1,现在是allure2了,官方已经不维护1了。

  pypi中具体用法已经说得很清楚了https://pypi.org/project/allure-pytest/

  

 

 三、编写用例

Test.py

import allure
import pytest@allure.feature("Test")
class Test:@allure.story("比较数值")def test_01(self):"""这是1号用例:return:"""assert 0 == 0@allure.story("比体积")def test_02(self):"""这是2号用例:return:"""assert 0 == 1

 

四、执行用例

  

  在项目根目录下执行如下命令,就会执行Test.py模块中的用例,生成report文件里面存放的是后面报告需要解析的json文件,包含了用例的所有信息。

  执行这个Test.py模块下的用例,--alluredir=report 生成report目录存放数据,--clean-alluredir 清除原有的存放数据路径

  

pytest .\Test.py --alluredir=report --clean-alluredir

 

  

 

   

 

 五、生成报告

  执行命令解析json文件并生成html报告,并启动服务

  

allure serve report

 

  

 

 六、查看报告

  

 

转载于:https://www.cnblogs.com/gcgc/p/11557693.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/391195.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

lintcode433 岛屿的个数

岛屿的个数 给一个01矩阵,求不同的岛屿的个数。 0代表海,1代表岛,如果两个1相邻,那么这两个1属于同一个岛。我们只考虑上下左右为相邻。 您在真实的面试中是否遇到过这个题? Yes样例 在矩阵: [[1, 1, 0, …

大数据分析要学习什么_为什么要学习数据分析

大数据分析要学习什么The opportunity to leverage insights from data has never been greater.利用来自数据的洞察力的机会从未如此大。 Humans tend to generate a lot of data each day - from heart rates to favorite songs, fitness goals and movie preferences. You …

POJ - 3257 Cow Roller Coaster (背包)

题目大意:要用N种材料建一条长为L的路,如今给出每种材料的长度w。起始地点x。发费c和耐久度f 问:在预算为B的情况下,建好这条路的最大耐久度是多少 解题思路:背包问题 dp[i][j]表示起始地点为i。发费为j的最大耐久度…

leetcode 1473. 粉刷房子 III(dp)

在一个小城市里,有 m 个房子排成一排,你需要给每个房子涂上 n 种颜色之一(颜色编号为 1 到 n )。有的房子去年夏天已经涂过颜色了,所以这些房子不需要被重新涂色。 我们将连续相同颜色尽可能多的房子称为一个街区。&a…

大学生信息安全_给大学生的信息

大学生信息安全You’re an undergraduate. Either you’re graduating soon (like me) or you’re in the process of getting your first college degree. The process is not easy and I can only assume how difficult the pressures on Masters and Ph.D. students are. Ho…

打破冷漠僵局文章_保持冷静并打破僵局-最佳

打破冷漠僵局文章Hack The Box (HTB) is an online platform allowing you to test your penetration testing skills. It contains several challenges that are constantly updated. Some of them simulating real world scenarios and some of them leaning more towards a …

使用DOM Breakpoints找到修改属性的Javascript代码

使用Chrome开发者工具的DOM断点功能可以让您快速找到修改了某一个DOM元素的Javascript代码。 在Chrome开发者工具里,选中想要监控的DOM元素,点击右键,选择Break on->Attributes modifications: 之后在DOM Breakpoints的tab里能看到对应的断…

特斯拉最安全的车_特斯拉现在是最受欢迎的租车选择

特斯拉最安全的车Have you been curious to know which cars are most popular in US and what are their typical rental fares in various cities? As the head of Product and Data Science at an emerging technology start-up, Ving Rides, these were some of the quest…

leetcode 740. 删除并获得点数(dp)

给你一个整数数组 nums ,你可以对它进行一些操作。 每次操作中,选择任意一个 nums[i] ,删除它并获得 nums[i] 的点数。之后,你必须删除每个等于 nums[i] - 1 或 nums[i] 1 的元素。 开始你拥有 0 个点数。返回你能通过这些操作…

WebSocket入门

WebSocket前言  WebSocket是HTML5的重要特性,它实现了基于浏览器的远程socket,它使浏览器和服务器可以进行全双工通信,许多浏览器(Firefox、Google Chrome和Safari)都已对此做了支持。 在WebSocket出现之前&#xff…

安卓游戏开发推箱子_保持冷静并砍箱子-开发

安卓游戏开发推箱子Hack The Box (HTB) is an online platform allowing you to test your penetration testing skills. It contains several challenges that are constantly updated. Some of them simulating real world scenarios and some of them leaning more towards …

自定义TabLayout

本文为kotlin仿开眼视频Android客户端的后续补充内容,本篇为大家介绍如何对TabLayout进行定制使用,基于项目需求,本篇主要对部分功能进行了定制,如:指示器距离文字的距离、文字选中加粗、文字选中变大等 本文部分代码参…

ml dl el学习_DeepChem —在生命科学和化学信息学中使用ML和DL的框架

ml dl el学习Application of Machine Learning and Deep Learning for Drug Discovery, Genomics, Microsocopy and Quantum Chemistry can create radical impact and holds the potential to significantly accelerate the process of medical research and vaccine developm…

响应式网站设计_通过这个免费的四小时课程,掌握响应式网站设计

响应式网站设计This video tutorial from Kevin Powell teaches you to build responsive websites from scratch. 凯文鲍威尔(Kevin Powell)的这段视频教程教您从头开始构建响应式网站。 The course starts with explaining the core concepts needed to start thinking resp…

2017-2018-1 20179215《Linux内核原理与分析》第二周作业

20179215《Linux内核原理与分析》第二周作业 这一周主要了解了计算机是如何工作的,包括现在存储程序计算机的工作模型、X86汇编指令包括几种内存地址的寻址方式和push、pop、call、re等几个重要的汇编指令。主要分为两部分进行这周的学习总结。第一部分对学习内容进…

python:单例模式--使用__new__(cls)实现

单例模式:即一个类有且仅有一个实例。 那么通过python怎么实现一个类只能有一个实例呢。 class Earth:"""假如你是神,你可以创造地球"""print 欢迎来到地球# 生成一个地球 a Earth() print id(a)# 再生成一个地球 b Ear…

重学TCP协议(5) 自连接

1.自连接是什么 在发起连接时,TCP/IP的协议栈会先选择source IP和source port,在没有显示调用bind()的情况下,source IP由路由表确定,source port由TCP/IP协议栈从local port range中选取尚未使用的port。 如果destination IP正…

Gradle复制文件/目录方法

2019独角兽企业重金招聘Python工程师标准>>> gradle复制文件/文件夹方法 复制文件 //复制IDE生成的classes.jar文件到build/libs中,并改名为FileUtils.jar. task copyFile(type:Copy) {delete build/libs/FileUtils.jarfrom(build/intermediates/bundles…

用户参与度与活跃度的区别_用户参与度突然下降

用户参与度与活跃度的区别disclaimer: I don’t work for Yammer, this is a public data case study, I’ve written it in a narrative format to make this case study more engaging to read.免责声明:我不为Yammer工作,这是一个公共数据案例研究&am…

python:__new__()与__init__()

参考:https://blog.csdn.net/qq_41020281/article/details/79638370 转载于:https://www.cnblogs.com/gcgc/p/11585599.html