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


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))

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM