PyTest装饰器

  1. 控制用例执行顺序的方法
  2. 在需要调整用例执行顺序的函数(或方法)前增加
    1. @pytest.mark.run(order=x) x表示数字
  3. 数字形式: 小数、整数、负数

执行顺序:

1、由小到大

2、由正到负

3、未标记 的在正数后,负数前执行

顺序: 1,2,3,无标记,-3,-2,-1

  1. 控制用例执行顺序的方法
  2. 在需要调整用例执行顺序的函数(或方法)前增加
    1. @pytest.mark.run(order=x) x表示数字
  3. 数字形式: 小数、整数、负数

执行顺序:

1、由小到大

2、由正到负

3、未标记 的在正数后,负数前执行

顺序: 1,2,3,无标记,-3,-2,-1

几个常用装饰,没有涉及的大家多多补充~

  1. pytest.ini 配置文件
    1. 例子: [pytest] addopts = -v -s --html=py_test/scripts/report/report.html -p no:warnings --reruns=10 testpaths = ./py_test/scripts python_files= test_rerun.py python_classes = Test* python_function = test* xfail_strict = true
相关推荐
程序员三藏5 小时前
接口自动化测试之 pytest 接口关联框架封装
自动化测试·软件测试·python·测试工具·测试用例·pytest·接口测试
旦莫1 天前
怎么才能算对自动化测试框架二次开发(以Pytest为例)
python·测试开发·pytest·ai测试
彩色面团儿3 天前
Pytest框架测试用例分析(测试笔记二)
笔记·测试用例·pytest
阿蔹4 天前
Python-Pytest-Requests-API接口测试自动化框架2
python·自动化·pytest
彩色面团儿5 天前
Pycharm部署pytest运行测试(测试笔记一)
python·pycharm·集成测试·pytest
阿蔹5 天前
Python-Pytest
python·自动化·pytest
阿蔹6 天前
Python-Pytest-Requests-API接口测试自动化框架
python·自动化·pytest
先做个垃圾出来………6 天前
pytest + pytest-mock + pytest-parametrize为基础构建测试框架
microsoft·pytest