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
相关推荐
思则变8 小时前
[Pytest][Part 1]Pytest 自动化测试框架
pytest
思则变2 天前
[Pytest] [Part 2]增加 log功能
开发语言·python·pytest
思则变2 天前
[Pytest][Part 3]检测python package状态
pytest
cooldream200916 天前
pytest 框架详解与实战指南
pytest·测试
慕城南风16 天前
【pytest进阶】Pytest之conftest详解
pytest
编程小白gogogo17 天前
AI自动化测试速成(Pytest框架)
pytest
慕城南风17 天前
【pytest进阶】pytest详解及进阶使用
linux·服务器·pytest
Tom Boom24 天前
Pytest断言全解析:掌握测试验证的核心艺术
自动化测试·python·测试开发·pytest
不要一直敲门1 个月前
初学 pytest 记录
pytest