import unittest from parameterized import parameterized from lib.res import ResApi from tools.utility import Utility #后台管理 test_data_conf_path = '../conf/testdata.json' base_conf = '../conf/base_jiang.json' test_data = Utility.get_json(test_data_conf_path) res_test_data = Utility.get_excel_dict_tup_list(test_data["res_api"]) print(res_test_data) class ResTest(unittest.TestCase): def setUp(self) -> None: self.Res = ResApi(base_conf) def tearDown(self) -> None: pass @parameterized.expand(res_test_data) def test_res(self, res_data): res_resp = self.Res.do_res(res_data) res_resp_code = res_resp.status_code res_resp_content = res_resp.text print(res_resp_code) actual = res_resp_content expect = res_data['expect'] # print(actual) # print(expect)
import unittest from parameterized import parameterized from lib.interview import InterViewApi from tools.utility import Utility test_data_conf_path = '../conf/testdata.json' base_conf = '../conf/base_jiang.json' test_data = Utility.get_json(test_data_conf_path) Inter_test_data = Utility.get_excel_dict_tup_list(test_data["interview_api"]) print(Inter_test_data) class InterViewTest(unittest.TestCase): def setUp(self) -> None: self.Inter = InterViewApi(base_conf) def tearDown(self) -> None: pass @parameterized.expand(Inter_test_data) def test_inter(self, inter_data): inter_resp = self.Inter.do_interview(inter_data) inter_resp_code = inter_resp.status_code inter_resp_content = inter_resp.text print(inter_resp_code) actual = inter_resp_content expect = inter_data['expect'] # print(actual) # print(expect)
import unittest from parameterized import parameterized from lib.employee import EmployeeApi from tools.utility import Utility test_data_conf_path = '../conf/testdata.json' base_conf = '../conf/base_jiang.json' test_data = Utility.get_json(test_data_conf_path) Emp_test_data = Utility.get_excel_dict_tup_list(test_data["employee_api"]) print(Emp_test_data) class InterViewTest(unittest.TestCase): def setUp(self) -> None: self.Emp = EmployeeApi(base_conf) def tearDown(self) -> None: pass @parameterized.expand(Emp_test_data) def test_inter(self, emp_data): emp_resp = self.Emp.do_employee(emp_data) emp_resp_code = emp_resp.status_code emp_resp_content = emp_resp.text print(emp_resp_code) actual = emp_resp_content expect = emp_data['expect'] # print(actual) # print(expect)