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 帮助,要查询或了解。

相关推荐
2601_962387822 天前
web自动化测试实战教程【selenium/unittest/pytest】【共193课
selenium·pytest·devops·web自动化测试·unittest
weixin_440730502 天前
使用pytest中方法控制执行步骤(test_begin.py、test_end.py,@pytest.mark.run(order=1))
开发语言·python·pytest
2601_962297253 天前
Python、Pytest、Allure、Selenium和Jenkins实现自动化测试集成实例
python·selenium·jenkins·pytest·allure
2601_962077604 天前
从零搭建Python接口自动化测试框架:pytest+requests实战指南
python·pytest·接口自动化·requests·框架搭建
weixin_440730504 天前
pytest结合allure生成html测试报告(step、story、severity、screenshot)
前端·html·pytest·allure报告
拜托多多指教4 天前
【Pytest框架学习】分层架构
python·pytest
2601_962299884 天前
python脚本如何单元测试
python·单元测试·pytest·unittest·mock对象
Tizzy JJ5 天前
Python + pytest 接口自动化测试框架实战:从零搭建企业级项目骨架
开发语言·python·pytest
Tizzy JJ5 天前
接口自动化测试实战:如何围绕真实业务场景设计高质量用例
python·自动化·pytest
测试老哥6 天前
Pytest 之assert断言的使用
自动化测试·软件测试·python·测试工具·测试用例·pytest·接口测试