zoukankan      html  css  js  c++  java
  • 模块六 测试报告定制

    学习文档

    https://docs.qameta.io/allure/#

    安装allure-pytest

     

     生成测试报告需要两个步骤:

    ① 生成测试报告

    pytest --alluredir=./result/1

    (执行路径result/1下)

    ② 打开测试报告:

    allure serve ./result/1

     

     

     

     希望在报告中看到测试功能,子功能,测试步骤,包括测试附加信息

    测试功能  

    allure.features("登录模块")
    class TestLogin:
        @allure.story("登录成功")
        def test_login_success(self):
            print("这是登录:测试用例,登录成功")
            pass

    子功能 

    class TestLogin:
        @allure.story("登录成功")
        def test_login_success(self):
            print("这是登录:测试用例,登录成功")
            passc

     测试步骤

        def test_login_failure(self):
            with allure.step("点击用户名"):
                print("输入用户名")
            with allure.step("点击用户密码"):
                print("输入密码")
            print("点击登录")
    
            with allure.step("登录登录之后登录失败"):
                assert 1 == 1
                print("登录失败")
            pass 

    如果只测试登录功能运动的时候可以加限制过滤:

    pytest  文件名  --allure-features "登录功能"

    allure generate ./result/ -o ./report/ --clean

    打开测试报告

    allure open -h 127.0.0.1 -p 8883 ./report/

     

     feature/story

    # Author:Han
    # python:3.9
    import  allure
    
    @allure.link("https://se.hundsun.com/browse/TZCSII-3266?filter=-2",name = '缺陷记录平台')
    def test_with_link():
        print("这是一条加了链接的测试")
        pass
    

      

  • 相关阅读:
    git Permissions 0777 for '/home/xxx/.ssh/id_rsa' are too open.
    Linux wc指令解析
    RK3288 开机动画旋转
    tp3.2 事务
    PHP实现动态获取函数参数的方法
    laravel 配置设置
    swoole 使用异步redis的前置条件
    php回调函数的概念及实例
    swoole 安装
    linux 源码安装PHP
  • 原文地址:https://www.cnblogs.com/hantongxue/p/14327439.html
Copyright © 2011-2022 走看看