pytest文档40 您所在的位置:网站首页 使用clean命令清除了数据 pytest文档40

pytest文档40

2023-07-10 21:28| 来源: 网络整理| 查看: 265

前言

使用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



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有