python pytest实战一:运行pytest测试的三种方式

pytest运行方式:

1、pycharm界面运行

2、右键 文件/目录运行

3、使用命令行方式运行,常用的执行参数:

  • pytest --collect-only 只收集用例
  • pytest -k “add ” 匹配所有名称中包含add的用例(‘add or div’ ‘TestClass’)
  • pytest -m mark标签名 标记
  • pytest - - junitxml=./result.xml 生成执行结果文件
  • pytest --setup-show 回溯fixture的执行过程
  • 更多用法,使用pytest --help查看帮助介绍
posted @ 2021-02-02 16:23  半路回归  阅读(594)  评论(0)    收藏  举报