Pytest-重运行机制

一、安装

pip install pytest-rerunfailures

二、运行

命令行参数:pytest -- reruns 重试次数 (--reruns-delay 次数之间间隔)
                  pytest --reruns 2 运行失败的用例可以执行2次
                  pytest --reruns 2 --reruns-delay 5 运行失败的用例可以执行2次,每次间隔5秒
pytest.main(["-v","-m","demo","--reruns","2","--reruns","-delay","5","--alluredir=../OutPuts/allure-results"])

三、效果:

设置失败的的用例再次运行

猜你喜欢

转载自www.cnblogs.com/minghong/p/11896188.html