pytest-allure清空上一次运行的记录(--clean-alluredir)用例重复显示

 

指定--clean-alluredir参数清空上一次执行记录:

  如果我们想每次执行用例的时候都生成新的测试报告,那么我们可以在命令中加上--clean-alluredir参数。

我们先来看一下跟报告相关的三个参数,命令行中使用pytest -h查看:

  •  --alluredir=DIR:指定测试报告的生成路径;
  • --clean-alluredir:如果已经存在报告,那就先清空,然后再生成新的测试报告;
  • --allure-no-capture:不添加pytest捕捉的logging/stdout/stderr到测试报告中;

我们加上--clean-alluredir参数重新执行下测试用例:

if __name__ == "__main__":
pytest.main(['testlogin.py','-s','--alluredir','../report/tmp'])
os.system('allure generate ../report/tmp -o ../report/report --clean-alluredir')
努力 努力在努力一点
原文地址:https://www.cnblogs.com/fanxianhua/p/15420124.html