美文网首页
pytest拓展

pytest拓展

作者: Lutous | 来源:发表于2021-02-25 09:32 被阅读0次

调整执行顺序:

安装:
  • pip install pytest-ordering
用法:
  • @pytest.mark.last
  • @pytest.mark.run(order=1)

失败后重新运行:

安装:
  • pip install pytest-rerunfailures
用法:
  • pytest -v --reruns 5 --reruns-delay 1 --- 每次等1秒,重跑5次

断言失败后继续运行:

安装:
  • pip install pytest-assume
用法:
  • pytest.assume(1==2)

多线程、分布式运行:

前提:
  • 用例之间独立,无先后顺序
  • 可重复运行,不影响其他用例
安装:
  • pip install pytest-xdist
用法:
  • pytest -n num num个线程同时运行

参考:https://blog.csdn.net/qq_42610167/article/details/101204066

相关文章

网友评论

      本文标题:pytest拓展

      本文链接:https://www.haomeiwen.com/subject/wzykfltx.html