• Pytest 参数参考


    1.  -vs  表示既输出调试信息同时输出执行详细信息  : pytest -vs ./pytest_1
    2. -n   支持多线程或者分布式运行测试用例
    3. --reruns   失败用例重跑   : pytest -vs ./pytest_1/test_login.py --reruns 2
    4. -x   只要存在失败用例则停止执行  : pytest -vs ./pytest_1/test_login.py -x
    5. --maxfail   只要存在max个失败用例则停止执行 :pytest -vs ./pytest_1/test_login.py --maxfail 2
    6.  -k   根据测试用例的部分字符串执行用例  :  pytest -vs ./pytest_1/test_login.py -k "oo"
    7.  --html 生成测试报告  : pytest --html ./reports/report.html
    8. -s    表示输出调试信息,包括print打印信息 :
    9. -v   表示输出用例执行详细信息
    10. -k 运行匹配给定子字符串表达式的类、方法、function :

                pytest -k "dir" 可运行dir目录下的用例

               pytest -k "dir2" 无法获取dir2目录下的用例

    11.     --collect-only  只收集测试用例不运行 :pytest --collect-only

    12.     --tb=no  简洁打印输出结果   ---- 好像也不怎么简洁

               pytest --tb=no

              其他输入类型 print mode (auto/long/short/line/native/no)

    13.     -m  只运行匹配给定标记表达式的测试

               需要 import pytest,pytest.mark.关键字

               pytest -m run_these --tb=no

                只会运行 test_passing2、 test_passing3

    14.      pytest -l  or –showlocals  运行失败打印变量的值   -- 所以这是lmn的l

    15.      pytest --version   显示版本

    16.      --lf  (last fail)  缓存,只运行上次执行错误的用例

  • 相关阅读:
    初步认识机器学习(Machine Leaning)
    第12章 PyTorch图像分割代码框架-1
    调用api接口获取token
    wireshark常见使用表达式
    高新企业认定条件
    数学中的基
    Exposure X8标准版图片后期滤镜PS、LR等软件的插件
    Stimulsoft Dashboards.PHP 2022.4.3 Crack
    Git常用指令
    循环结构--do-while循环
  • 原文地址:https://blog.csdn.net/yanghaoji/article/details/127635124