zoukankan      html  css  js  c++  java
  • 参数化:

    l1 = [10086, 10010, 110, 120]
    code = ["xxx","ppppp","oooo","wwww"]

    @pytest.mark.parametrize("mobile,code",zip(l1,code))
    def test_case(mobile,code):
    print(mobile,code)
    assert 1


    结果:

    =========================================================== test session starts ============================================================
    platform win32 -- Python 3.6.6, pytest-5.3.2, py-1.8.1, pluggy-0.13.1 -- c:python36python.exe
    cachedir: .pytest_cache
    rootdir: D:s27day68, inifile: pytest.ini, testpaths: ./scripts
    collected 4 items

    scripts/test_case.py::test_case[10086-xxx] 10086 xxx
    PASSED
    scripts/test_case.py::test_case[10010-ppppp] 10010 ppppp
    PASSED
    scripts/test_case.py::test_case[110-oooo] 110 oooo
    PASSED
    scripts/test_case.py::test_case[120-wwww] 120 wwww
    PASSED

    ============================================================ 4 passed in 0.07s =============================================================

  • 相关阅读:
    Map
    Collection接口之Set
    Collection接口之List、泛型
    简介
    递归
    File类
    转换流InputStreamReader、OutputStreamWriter
    springmvc
    集合
    SpringCloud学习笔记
  • 原文地址:https://www.cnblogs.com/zhang-da/p/12219741.html
Copyright © 2011-2022 走看看