def init_data():
    data = [{"zhang", "123"}, {"lisang", "456"}]
    return data

class test_skip:

    #单个参数
    @pytest.mark.parametrize('name', ["tom", "zhang", "jun"])
    def test_a(self,name):
        print(name)

    #多个参数
    @pytest.mark.parametrize("username,password", init_data())
    def  test_b(self,username,password):
        print("用户名:%s,密码:%s 成功!"%(username,password))

  pytest设置单个函数和多个函数的参数化

 

相关文章:

  • 2021-10-02
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-01-01
  • 2021-07-15
  • 2022-12-23
猜你喜欢
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案