Skip to content

Allure2 报告中支持记录失败重试功能


简介

Allure 可以收集用例运行期间,重试的用例的结果,以及这段时间重试的历史记录。


Allure2 失败重试功能

重试功能需使用 pytest 相关的插件,例如 pytest-rerunfailures

安装方式为:pip install pytest-rerunfailures


示例

  • reruns:定义重试的次数。
  • reruns_delay:定义每次重试间隔的时间。
import pytest

@pytest.mark.flaky(reruns=2, reruns_delay=2)
def test_rerun2():
    assert False

重试的结果信息,会展示在详情页面的Retries 选项卡中。


总结

  • Allure 失败重录功能简介
  • Allure 失败重试功能的使用