zoukankan      html  css  js  c++  java
  • pytest文档40-allure报告清空上一次运行的记录(--clean-alluredir)

    前言

    使用allure 生成报告的时候,当你的用例名称修改后,会发现保留了上一次的用例运行记录。
    如果你想先清空之前的记录再生成新的报告,可以再运行用例的时候加上 --clean-alluredir 命令行参数。

    问题描述

    allure报告可以记录你用例每次执行的情况,这样方便跟踪用例的成功率

    但是也会带来一个新的问题,当你代码里面的用例删除或者更换名称后,依然会记录之前的用例报告

    --clean-alluredir 清空

    如果你想每次用例执行之前先清空allure的报告记录,可以加个参数 --clean-alluredir
    使用 pytest -h 可以查看报告相关的三个参数

    reporting:
      --alluredir=DIR       Generate Allure report in the specified directory (may
                            not exist)
      --clean-alluredir     Clean alluredir folder if it exists
      --allure-no-capture   Do not attach pytest captured logging/stdout/stderr to
                            report
    

    reporting 报告相关参数
    --alluredir=DIR 指定报告的目录路径
    --clean-alluredir 如果已经存在报告,就先清空它
    --allure-no-capture 不加载 logging/stdout/stderr 文件到报告

    带上 clean-alluredir 参数重新执行用例

    pytest --alluredir ./report/allure_report --clean-alluredir
    allure serve ./report/allure_report

  • 相关阅读:
    JDBC笔记01-JDBC,Connection,Statement,ResultSet,PreparedStatement,Properties
    JavaWeb笔记05-解决线程安全问题
    JavaWeb笔记04-解决GET与POST乱码问题
    JavaWeb笔记02-Tomcat
    HttpServletResponse类
    ServletContext类
    Servlet类以及简单的登录功能
    http和Tomcat协议
    XML
    反射
  • 原文地址:https://www.cnblogs.com/yoyoketang/p/13028203.html
Copyright © 2011-2022 走看看