allure测试报告的基础用法

Allure 测试报告的用法:
简介:Allure框架是一个灵活的轻量级多语言测试报告工具,它不仅以web的方式展示了简介的测试结果,而且允许参与开发过程的每个人从日常执行的测试中最大限度的提取有用信息。

#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2021/2/2 10:23
# @Author  : Sun
# @Email   : 8009@163.com
# @File    : test_five.py
# @Software: PyCharm

import allure
import pytest


class Severity(object):
    Blocker="blocker"
    CRITICAL="critical"
    NORMAL="normal"
    MINOR="minor"
    TRIVIAL="trivial"
    
@pytest.fixture()
def login():
    print("前置条件,请先登录")

@allure.step("one")
def one():
    print("这是第一步操作!")
    
@allure.step("two")
def two():
    print("这是第二步操作!")
    
@allure.step("three")
def three():
    print("这是第三步操作!")
    
@allure.epic("epic对大Story的一个描述性标签")
@allure.feature("功能测试模块")
class TestOne(object):
    @allure.testcase(url="http://www.testclass.net/post/2021_automation")
    @allure.issue("http://www.testclass.net/post/2021_automation")
    @allure.title("正常账户和密码测试")
    @allure.story("账户为admin,密码root")
    @allure.description("上面的代码会捕获一个类型为 ExceptionName 的异常。如果您想让 "
                        "catch 块能够处理 try 块抛出的任何类型的异常,则必须在异常声明的括号内使用省略号 .")
    @allure.severity(severity_level=Severity.NORMAL)
    @pytest.mark.usefixtures("login")
    def test_one(self):
        one()
        two()
    
    @allure.story("账户为admin,密码admin")
    def test_two(self):
        two()
        three()
        
        
@allure.epic("这是一个新的一个描述性标签")
@allure.story("UI测试模块")
class TestTwo(object):
    @pytest.mark.usefixtures("login")
    @allure.title("账号:admin 密码:123456")
    def test_three(self):
        print("=========================================")

    @allure.title("账号:admin 密码:123456")
    def test_four(self):
        print("-----------------------------------------")
    

运行脚本后查看生成的测试报告:
在这里插入图片描述
allure的一些基础操作:
在这里插入图片描述
详细操作可以参考官方链接:官网地址

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值