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
相关推荐
努力搬砖的咸鱼1 天前
从零开始搭建 Pytest 测试框架(Python 3.8 + PyCharm 版)
python·pycharm·pytest
FINE!(正在努力!)3 天前
PyTest框架学习
学习·pytest
程序员杰哥4 天前
接口自动化测试之pytest 运行方式及前置后置封装
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·pytest
测试老哥4 天前
Pytest+Selenium UI自动化测试实战实例
自动化测试·软件测试·python·selenium·测试工具·ui·pytest
水银嘻嘻4 天前
07 APP 自动化- appium+pytest+allure框架封装
python·appium·自动化·pytest
天才测试猿5 天前
接口自动化测试之pytest接口关联框架封装
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·pytest
not coder6 天前
Pytest Fixture 详解
数据库·pytest
not coder6 天前
pytest 常见问题解答 (FAQ)
开发语言·python·pytest
程序员的世界你不懂6 天前
(1)pytest简介和环境准备
pytest
not coder6 天前
Pytest Fixture 是什么?
数据库·oracle·pytest