def __init__(self): self.excel_obj = ExcelOpt() self.res_title = {0: 'Case_ID', 1: 'URI', 2: 'Request_Info', 3: 'Expect_Result', 4: 'Actual_Result', 5: 'Test_Result'}
class TestCases(): def __init__(self): self.excel_obj = ExcelOpt() self.res_title = {0: 'Case_ID', 1: 'URI', 2: 'Request_Info', 3: 'Expect_Result', 4: 'Actual_Result', 5: 'Test_Result'} def input_title(self, sheet_name): for key, value in self.res_title.items(): self.excel_obj.write_data(sheet_name, 0, key, value, self.excel_obj.title_style()) def do(self, sheet_name): res_sheet_name = self.excel_obj.res_book.add_sheet(sheet_name) self.input_title(res_sheet_name) case_exec.CaseExec(self.excel_obj).run(sheet_name, res_sheet_name, self.res_title) def case_sheet1(self): sheet_name = 'Sheet1' self.do(sheet_name) def case_sheet2(self): sheet_name = 'Sheet2' self.do(sheet_name) def case_sheet3(self): sheet_name = 'Sheet3' self.do(sheet_name) def save(self): output_path = './output' res_file = time.strftime('%Y-%m-%d %H-%M-%S', time.localtime(time.time())) self.excel_obj.close(output_path + '/' + res_file + '.xls')