当前位置:网站首页>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')
边栏推荐
- Bookmark collection management software suspension reading and data migration between knowledge base and browser bookmarks
- Record the interesting process of using Xray for the first time
- Eslint reports an error
- 2837xd code generation module learning (1) -- GPIO module
- Alibaba cloud SMS service
- Project practice, redis cluster technology learning (16)
- Database -- acid of transaction -- introduction / explanation
- How to judge the quality of primary market projects when the market is depressed?
- 2837xd代码生成模块学习(4)——idle_task、Simulink Coder
- Matlab代码生成之SIL/PIL测试
猜你喜欢
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
AutoCAD - layer Linetype
Blender体积雾
Mysql索引
Tee command usage example
ESLint 报错
Illusion -- Animation blueprint, state machine production, character walking, running and jumping action
2837xd代码生成模块学习(4)——idle_task、Simulink Coder
Matlab生成dsp程序——官方例程学习(6)
【虚幻】武器插槽:拾取武器
随机推荐
How much is it to develop a system software in Beijing, and what funds are needed to develop the software
Edge computing accelerates live video scenes: clearer, smoother, and more real-time
Introduction to go language
Notes de base sur les plans illusoires d'IA (triés en 10 000 mots)
2837xd 代碼生成——補充(1)
Alibaba cloud SLS log service
Remember the use of add method once
How to judge the quality of primary market projects when the market is depressed?
Blender ocean production
2837xd code generation module learning (4) -- idle_ task、Simulink Coder
Ctrip starts mixed office. How can small and medium-sized enterprises achieve mixed office?
2837xd 代码生成——StateFlow(1)
Aiphacode is not a substitute for programmers, but a tool for developers
【UE5】蓝图制作简单地雷教程
Blender体积雾
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
The latest progress and development trend of 2022 intelligent voice technology
阿里云短信服务
ue4材质的入门和原理笔记
Pycaret | a few lines of code to solve machine learning modeling