How to use _get_graph_title method in Airtest

Best Python code snippet using Airtest Github


Full Screen

...238 self.benchmarks.write_comment(f'{letter}{last_row + 1}', comments[index])239 def _create_graphs(self):240 self._create_avg_latency_graph()241 self._create_mean_latency_by_location_graph()242 def _get_graph_title(self, title: str) -> str:243 if self.graphs_title_prefix:244 return f'{self.graphs_title_prefix} - {title}'245 return title246 def _create_mean_latency_by_location_graph(self):247 workbook = self.workbook248 chart = workbook.add_chart({'type': 'column'})249 sheet = self.mean_latency_by_location250 sheet_name = sheet.name251 chart.add_series({252 'name': f'={sheet_name}!$B$1',253 'categories': f'={sheet_name}!$A$2:$A${sheet.row}',254 'values': f'={sheet_name}!$B$2:$B${sheet.row}'255 })256 chart.set_title({'name': self._get_graph_title('Latency mean (ms)')})257 chart.x_scale = 2.5258 chart.y_scale = 2.5259 self.mean_latency_by_location.insert_chart('E2', chart, {'x_offset': 0, 'y_offset': 0})260 chart.set_style(self.chart_style)261 def _create_avg_latency_graph(self):262 workbook = self.workbook263 chart = workbook.add_chart({'type': 'line'})264 sheet = self.avg_latency265 sheet_name = sheet.name266 chart.add_series({267 'name': f'={sheet_name}!$C$1',268 'categories': f'={sheet_name}!$A$2:$A${sheet.row}',269 'values': f'={sheet_name}!$C$2:$C${sheet.row}'270 })271 chart.set_title({'name': self._get_graph_title('Avg. latency (ms)')})272 chart.x_scale = 2.5273 chart.y_scale = 2.5274 chart.set_x_axis({'text_axis': True})275 self.avg_latency.insert_chart('E2', chart, {'x_offset': 0, 'y_offset': 0})276 chart.set_style(self.chart_style)277 def close(self):278 self._write_avg_latencies_by_location()279 self._write_formulas()280 self._create_graphs()...

Full Screen

Full Screen Github


Full Screen

...82 method_index += 1 # 进行下一个方法时:当前方法的序号+183 continue84 else:85 break86 def _get_graph_title(self):87 """获取图像的title."""88 start_time = datetime.fromtimestamp(int(self.timestamp_list[0]))89 end_time = datetime.fromtimestamp(int(self.timestamp_list[-1]))90 end_time = end_time.strftime('%H:%M:%S')91 title = "Timespan: %s —— %s" % (start_time, end_time)92 return title93 def plot_cpu_mem_keypoints(self):94 """绘制CPU/Mem/特征点数量."""95 plt.figure(1)96 # 开始绘制子图:97 plt.subplot(311)98 title = self._get_graph_title()99 plt.title(title, loc="center") # 设置绘图的标题100 mem_ins = plt.plot(self.time_axis, self.mem_axis, "-", label="Mem(MB)", color='deepskyblue', linestyle='-', marker=',')101 # 设置数字标签102 plt.legend(mem_ins, ["Mem(MB)"], loc='upper right') # 说明标签的位置103 plt.grid() # 加网格104 plt.ylabel("Mem(MB)")105 plt.ylim(bottom=0)106 for method_exec in self.method_exec_info:107 start_date = datetime.fromtimestamp(method_exec["start_time"])108 end_date = datetime.fromtimestamp(method_exec["end_time"])109 plt.vlines(start_date, 0, self.max_mem, colors="c", linestyles="dashed") # vlines(x, ymin, ymax)110 plt.vlines(end_date, 0, self.max_mem, colors="c", linestyles="dashed") # vlines(x, ymin, ymax)111 # 绘制mem文字:112 x = datetime.fromtimestamp(method_exec["mem_max_time"])...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?