def setUpClass(cls): logger.get_logger(__name__).info('准备测试前置') cls.http_test = http_request.HTTPRequest2() cls.mysql = do_mysql.DoMysql()
# cases.append(aaa) self.workbook.close() return cases #返回cases列表 def write_result(self, row, actual, result): sheet = self.workbook[self.sheet_name] sheet.cell(row, 7).value = actual sheet.cell(row, 8).value = result self.workbook.save(filename=self.file_name) self.workbook.close() if __name__ == '__main__': sheet_names = ['login', 'recharge', 'withdraw'] res = http_request.HTTPRequest2() #同一个session for item in sheet_names: do_excel = DoExcel('testcase.xlsx', sheet_name=item) cases = do_excel.get_cases() for case in cases: print(case.title) print(case.url) print(case.data) print(type(case.data)) print(case.__dict__) #所有属性字典 resp = res.request(case.method, case.url, case.data) print(resp.text) print(case.expected) actual = resp.text