
1 class TestEnorll(): 2 3 def get_data(self): 4 """ 5 讀取json文件 6 :return: 7 """ 8 data = [] 9 with open(self, 'r') as f: 10 dict_data = json.loads(f.read()) 11 for i in dict_data: 12 data.append(tuple(i.values())) 13 return data 14 15 @pytest.mark.parametrize( 16 "name, email, pwd, pwd_", 17 get_data(BASE_DIR + '\\data' + '\\enorlluser.json'), 18 ids=['注冊成功', '密碼不一致', '會員輸入框為空', '重名注冊', '電子郵箱為空', '電子郵箱錯誤', '密碼輸入框為空'] 19 ) 20 def test_case(self, browser, name, email, pwd, pwd_, url=None): 21 obj = Enorllpage(browser) 22 pass
.json結尾的文件.......