pytest失败重跑

失败重跑需要依赖pytest-rerunfailures插件,使用pip安装就行

pip install pytest-rerunfailures

用例失败重跑的方法:

  1. 在用例上添加装饰器@pytest.mark.flaky(reruns=2, reruns_delay=4)  reruns为次数,reruns_delay间隔时间,单位s(对部分用例生效)

  2. 在pytest.ini文件中addopts = 添加参数–reruns n (n:为重试的次数)(对所有用例生效)

方法一:单个用例失败重跑

方法二:所有用例失败重跑

posted on 2020-03-27 13:52  crystal1126  阅读(784)  评论(0编辑  收藏  举报

导航