allure使用

一 配置使用allure

在这里插入图片描述

二 生成html报告

Report successfully generated to allure-report
(venv) D:\pyscript\tangseng\Interface_AutoTest\report>

三 代码

import requests
import yaml
import pytest
import allure
# @allure.step("类级别测试步骤")
@allure.feature("我是一级需求")
class Testclass():
    @allure.story("二级需求1")
    @allure.severity(allure.severity_level.CRITICAL)
    def test01(self):
        allure.attach("这是一个纯文本1",name="文本信息1",attachment_type=allure.attachment_type.TEXT)
        print("in test01-1")
        allure.attach("这是一个纯文本2", name="文本信息2", attachment_type=allure.attachment_type.TEXT)
        print("in test01-2")
        assert 1

    @allure.story("二级需求2")
    @allure.severity(allure.severity_level.CRITICAL)
    def test02(self,f_module):
        with allure.step("第一步"):
            print("in test1")
        allure.attach.file("./1.jpeg",name="图片",attachment_type=allure.attachment_type.JPG)
        with allure.step("第二步"):
            print("in test2")
        with allure.step("第3步"):
            print("in test3")

        assert 1
    @allure.story("二级需求1")
    @allure.issue('https://www.sohu.com','bug名称')
    @allure.testcase('www.baidu.com','测试用例名称')
    @allure.link("www.qq.com",name="腾讯主页")
    @allure.severity(allure.severity_level.CRITICAL)
    @allure.title('新标题')
    @allure.description("<font color='red'>描述第一行</font><Br/>描述第二行<Br/>描述第三行")
    def test03(self):
        allure.attach("<body>这是一个网页</body>", name="HTML测试模块", attachment_type=allure.attachment_type.HTML)
        print("in test03")
        assert 1
if __name__ == "__main__":
    pytest.main()

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值