pytest拓展

调整执行顺序:

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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容