08、分析测试执行时间及获取pytest帮助

官方用例

python 复制代码
# content of test_slow_func.py
import pytest
from time import sleep

@pytest.mark.parametrize('delay',(1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.0,0.1,0.2,0,3))
def test_slow_func(delay):
    print("test_slow_func {}".format(delay))
    sleep(delay)
    assert 1

解读与实操

  • 查询pytest版本号
  • 查询所有pytest的fixture
  • 查询所有pytest的帮助

应用场景

  • 遇到新场景,想查看下pytest中是否有相应实现。
  • 看到其他人使用了某个特性,要了解相关用法

以上两种场景,都可以通过pytest -h 帮助,要查询或了解。

相关推荐
程序员三藏10 小时前
接口自动化测试之 pytest 接口关联框架封装
自动化测试·软件测试·python·测试工具·测试用例·pytest·接口测试
旦莫2 天前
怎么才能算对自动化测试框架二次开发(以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