pytest-allure相关

安装

  • mac 安装allure
     brew install alluer
    
  • 安装插件 allure-pytest
    pip3 install allure-pytest
    

生成报告

  • 第一种方式
    pytest test_01.py --alluredir=./report --clean-alluredir
    allure serve /Users/xxx/Documents/dev/report
    
  • 第二种方式
    pytest test_01.py --alluredir=./report --clean-alluredir
    allure generate ./report -o ./report/webreport # 第一个路径是生成的数据路径 第二个路径是生成html报告放到什么路径下面
    

allure函数使用

  • 一级标题allure.epic

    @allure.epic("测试登录模块1")
    def test001():
        with allure.step("打开浏览器"):
            pass
    
  • 二级标题allure.feature

    @allure.feature("测试登录模块2")
    def test001():
        with allure.step("打开浏览器"):
            pass
    
  • 三级标题allure.story

    @allure.story("测试登录")
    def test001():
        with allure.step("打开浏览器"):
            pass
    
  • 用例名称allure.title

    @allure.title("测试用例") # 测试报告讲函数名替换成该用例名称
    def test001():
        with allure.step("打开浏览器"):
            pass
    
  • 执行步骤allure.step

    @allure.title("测试用例") # 测试报告讲函数名替换成该用例名称
    def test001():
        with allure.step("打开浏览器"):
            pass
    
posted @   zhq9  阅读(21)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示