当前位置:网站首页>pytest--之测试报告allure配置
pytest--之测试报告allure配置
2022-07-02 06:36:00 【迷途~知返】
pytest--之测试报告allure配置
环境安装
本地环境
安装jdk1.8,同时配置环境变量
windows配置环境变量,在我的电脑上右键,点击属性,然后点击高级,进入如下页面,然后点击环境变量
1、环境变量配置,在系统变量中,新建系统变量配置JAVA_HOME,路径为,jdk的安装路径(D:\software\java_jdk),
然后点击确定
2、在系统变量中找到path,添加一个新的路径,%JAVA_HOME%\bingithub下载allure套件的版本:https://github.com/allure-framework/allure2/releases,同时配置环境变量(方法同上)
windows在环境中需要下载allure-pytest插件
pip install allure-pytest
- 版本检查
- pytest 版本检查,在终端中输入
- allure版本检查,在终端中输入
pytest --version
allure --version
- jdk安装成功检查
java
pytest之基础应用
- 测试数据生成
pytest.main(['--alluredir=./allure-result'])
- 生成报告
os.system('allure generate ./allure-result -o ./report')
- 基本代码
# coding:utf-8
import os
import allure
import pytest
def set_01():
print('start')
def set_02():
print('finish')
class TestDemo(object):
"""object"""
def test_01(self):
set_02()
set_01()
print('practice')
def test_02(self):
print('crazy')
if __name__ == '__main__':
pytest.main(['--alluredir=./allure-result'])
os.system('allure generate ./allure-result -o ./report')
测试报告
allure之基本用法
- 添加测试执行步骤
# coding:utf-8
import os
import allure
import pytest
@allure.step('天才第一步')
def set_01():
print('start')
@allure.step('雀氏纸尿裤')
def set_02():
print('finish')
class TestDemo(object):
"""object"""
def test_01(self, fix):
set_01()
set_02()
print('practice')
def test_02(self, fix):
print('crazy')
if __name__ == '__main__':
pytest.main(['--alluredir=./allure-result'])
os.system('allure generate ./allure-result -o ./report --clean')
运行结果
allure测试报告简介
- Overview:总览
- Categories:类别,默认是分了failed和error,凡是执行结果是其中一个的都会被归到类里面,可以通过这里快捷查看哪些用例是failed和error的,支持自定义
- Suites:测试套件,就是所有用例的层级关系,可以根据package、module、类、方法来查找用例
- Graphs:测试结果图形化,包括用例执行结果的分布图,优先级,耗时等
- Timeline:可以看到测试用例精确的测试时序(执行顺序),包括执行时间
- Behaviors:行为驱动,根据epic、feature、story来分组测试用例
- Packages:这就是按照package、module来分组测试用例了
allure基本使用
事件等级:
用例等级划分
--allure-severities=SEVERITIES_SET
Comma-separated list of severity names.
Tests only with these severities will be run.
Possible values are: blocker, critical, normal, minor, trivial.
blocker:阻塞缺陷(功能未实现,无法下一步)
critical:严重缺陷(功能点缺失)
normal: 一般缺陷(边界情况,格式错误)
minor: 次要缺陷(界面错误与ui需求不符)
trivial: 轻微缺陷(必须项无提示,或者提示不规范)
描述信息
@allure.description(‘描述信息’)
class TestDemo(object):
"""object"""
@allure.story('登录')
@allure.title("执行登录")
@allure.issue('http:123456789') # bug链接地址
@allure.testcase('http:123456789') # 功能用例的地址
@allure.severity('normal')
# @allure.description('描述信息')
def test_01(self):
""" 用例名称 用例步骤 预期结果 """
set_01()
set_02()
print('practice')
边栏推荐
- Aiphacode is not a substitute for programmers, but a tool for developers
- ue4材质的入门和原理笔记
- 阿里云ack介绍
- Project practice, redis cluster technology learning (12)
- 高考那些事
- 2837xd code generation module learning (4) -- idle_ task、Simulink Coder
- Notes de base sur les plans illusoires d'IA (triés en 10 000 mots)
- Database -- acid of transaction -- introduction / explanation
- UE5——AI追逐(藍圖、行為樹)
- 2837xd代码生成模块学习(1)——GPIO模块
猜你喜欢
随机推荐
[IDL] Research
2837xd 代码生成——StateFlow(2)
The latest progress and development trend of 2022 intelligent voice technology
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
[ue5] animation redirection: how to import magic tower characters into the game
Centos7 one click compilation and installation of PHP script
This article takes you to learn in detail what is fiber to home FTTH
虚幻AI蓝图基础笔记(万字整理)
The road is blocked and long, and the line is coming
ue虚幻引擎程序化植物生成器设置——如何快速生成大片森林
What wires are suitable for wiring on bread board?
2837xd code generation - Supplement (3)
Introduction et prévention des essais de pénétration
Blender模型导入ue、碰撞设置
Mysql索引
【避坑指南】Unity3D项目接入腾讯Bugly工具时遇到的坑
How does {} prevent SQL injection? What is its underlying principle?
Project practice, redis cluster technology learning (16)
Blender体积雾
2837xd code generation module learning (1) -- GPIO module