pytest拓展

2021-02-25  本文已影响0人  Lutous

调整执行顺序:

安装:
  • 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

上一篇 下一篇

猜你喜欢

热点阅读