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, In Email, pwd, pwd_ " , . 17 get_Data (base_dir + ' \\ Data ' + ' \\ enorlluser.json ' ), 18 is IDS = [ ' registration success ' , ' passwords do not match ' , ' member of the input box is empty ' , ' the same name registration ' , ' E-mail is empty ' , ' e-mail error ' , ' password input box is empty ' ] 19 ) 20 DEF test_case(self, browser, name, email, pwd, pwd_, url=None): 21 obj = Enorllpage(browser) 22 pass
.Json file ending .......