def excel_init(): excel.excel_fd = zexcel.excel_init() # 每个线程一个sheet for process in test.process: logging.info(process) excel.sheet_fd[process] = excel.excel_fd.add_sheet(process) # 增加sheet excel.sheet_fd[process].col(CASE_TIME_COL).width = 200 * 25 # 设置第1列列宽 excel.sheet_fd[process].col(CASE_MEM_COL).width = 200 * 25 # 设置第2列列宽 excel.row_point[process] = 0 rows = ['时间(分钟)', '内存(Kb)'] for index, val in enumerate(rows): excel.sheet_fd[process].write(excel.row_point[process], index, val, style=zexcel.set_style( zexcel.BLACK, 280, bold=True, pattern_color='gray25')) filename = os.path.join( os.path.dirname(__file__) + "./../results/" + test.output_file + ".xls") excel.excel_fd.save(filename) # 保存xls
def excel_init(module_name): excel.excel_fd = zexcel.excel_init() sheet_name = test.name + " " + module_name + "测试结果" excel.sheet_fd = zexcel.common_sheet_init(excel.excel_fd, sheet_name) # 从第二行开始写入 excel.row_point = 1 rows = ['', 'Count', 'Eth', 'Wifi', 'Time'] for index, val in enumerate(rows): excel.sheet_fd.write(1, index, val, style=zexcel.set_style(zexcel.BLACK, 280, bold=True, pattern_color='gray25')) # 写设备信息 excel.sheet_fd.write(zexcel.PROJECT_ROW, zexcel.PROJECT_COL + 1, test.project, style=zexcel.set_style(zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.VERSION_ROW, zexcel.VERSION_COL + 1, test.version, style=zexcel.set_style(zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.MAC_ROW, zexcel.MAC_COL + 1, test.mac, style=zexcel.set_style(zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.DATE_ROW, zexcel.DATE_COL + 1, test.date, style=zexcel.set_style(zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) filename = os.path.join( os.path.dirname(__file__) + "./../results/" + test.output_file + ".xls") excel.excel_fd.save(filename) # 保存xls
def excel_init(module_name): excel.excel_fd = zexcel.excel_init() sheet_name = test.name + " " + module_name + "测试结果" excel.sheet_fd = zexcel.sheet_init(excel.excel_fd, sheet_name) # 写设备信息 excel.sheet_fd.write(zexcel.PROJECT_ROW, zexcel.PROJECT_COL + 1, test.project, style=zexcel.set_style(zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.VERSION_ROW, zexcel.VERSION_COL + 1, test.version, style=zexcel.set_style(zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.MAC_ROW, zexcel.MAC_COL + 1, test.mac, style=zexcel.set_style(zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.DATE_ROW, zexcel.DATE_COL + 1, test.date, style=zexcel.set_style(zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) filename = os.path.join( os.path.dirname(__file__) + "./../results/" + test.output_file + ".xls") excel.excel_fd.save(filename) # 保存xls # 从第二行开始写入 excel.row_point = 1
def excel_init(module_name): excel.excel_fd = zexcel.excel_init() sheet_name = module_name + "测试结果" excel.sheet_fd = zexcel.common_sheet_init(excel.excel_fd, sheet_name) # 从第二行开始写入 excel.row_point = 1 rows = ['', 'Result', 'Version', 'Count'] for index, val in enumerate(rows): excel.sheet_fd.write(1, index, val, style=zexcel.set_style(zexcel.BLACK, 280, bold=True, pattern_color='gray25')) filename = os.path.join( os.path.dirname(__file__) + "./../results/" + test.output_file + ".xls") excel.excel_fd.save(filename) # 保存xls # 从第二行开始写入 excel.row_point = 1
def excel_init(): excel.excel_fd = zexcel.excel_init() excel.sheet_fd = zexcel.sheet_init(excel.excel_fd, "WIFI测试结果") # 从第二行开始写入 excel.row_point = 1
def excel_init(module_name): if excel_type == "xlsx": filename = os.path.join( os.path.dirname(__file__) + "/../results/" + test.output_file + ".xlsx") excel.excel_fd = xlsxwriter.Workbook(filename) sheet_name = module_name + "测试结果" excel.sheet_fd = excel.excel_fd.add_worksheet(sheet_name) # 增加sheet excel.sheet_fd.set_column(0, 3, 10) elif excel_type == "xls": sheet_name = module_name + "测试结果" excel.excel_fd = zexcel.excel_init() excel.sheet_fd = excel.excel_fd.add_sheet(sheet_name) # 增加sheet excel.sheet_fd.col(zexcel.CASE_NAME_COL).width = 200 * 15 # 设置第1列列宽 excel.sheet_fd.col(zexcel.CASE_RESULT_COL).width = 200 * 15 # 设置第2列列宽 excel.sheet_fd.col(zexcel.COUNT_COL).width = 200 * 15 # 设置第3列列宽 excel.sheet_fd.col(zexcel.PASS_COL).width = 200 * 15 # 设置第4列列宽 excel.sheet_fd.col(zexcel.FAIL_COL).width = 200 * 15 # 设置第5列列宽 excel.sheet_fd.col(zexcel.PROJECT_COL).width = 180 * 15 # 设置第7列列宽 excel.sheet_fd.col(zexcel.PROJECT_COL + 1).width = 360 * 15 # 设置第8列列宽 # 写第一行数据 excel.sheet_fd.write_merge(0, 0, 0, 4, sheet_name, zexcel.set_style(0x7FFF, 320, bold=True)) excel.sheet_fd.write(zexcel.PROJECT_ROW, zexcel.PROJECT_COL, "project:", style=zexcel.set_style( zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.VERSION_ROW, zexcel.VERSION_COL, "version:", style=zexcel.set_style( zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.MAC_ROW, zexcel.MAC_COL, "mac:", style=zexcel.set_style( zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.DATE_ROW, zexcel.DATE_COL, "date:", style=zexcel.set_style( zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) # 写设备信息 excel.sheet_fd.write(zexcel.PROJECT_ROW, zexcel.PROJECT_COL + 1, test.project, style=zexcel.set_style( zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.VERSION_ROW, zexcel.VERSION_COL + 1, test.version, style=zexcel.set_style( zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.MAC_ROW, zexcel.MAC_COL + 1, test.mac, style=zexcel.set_style( zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) excel.sheet_fd.write(zexcel.DATE_ROW, zexcel.DATE_COL + 1, test.date, style=zexcel.set_style( zexcel.BLACK, 260, bold=True, align='', pattern_color='light_orange')) filename = os.path.join( os.path.dirname(__file__) + "/../results/" + test.output_file + ".xls") excel.excel_fd.save(filename) # 保存xls # 从第二行开始写入 excel.row_point = 1