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