How to use wite_to_json method in Airtest

Best Python code snippet using Airtest

profile_recorder.py

Source:profile_recorder.py Github

copy

Full Screen

...149 "kp_src": len(kp_src),150 "good": len(good)}151 self.method_exec_info.append(ret_info)152 self.record_thread.stop_flag = True153 def wite_to_json(self, dir_path="", file_name=""):154 """将性能数据写入文件."""155 # 提取数据156 data = {157 "plot_data": self.record_thread.profile_data,158 "method_exec_info": self.method_exec_info,159 "search_file": self.search_file,160 "source_file": self.source_file}161 # 写入文件162 file_path = os.path.join(dir_path, file_name)163 if not os.path.exists(dir_path):164 os.makedirs(dir_path)165 json.dump(data, open(file_path, "w+"), indent=4)166def main():167 # 截屏[2907, 1403] 截图[1079, 804]168 search_file = "sample\\high_dpi\\tpl1551940579340.png"169 screen_file = "sample\\high_dpi\\tpl1551944272194.png"170 # 准备性能数据记录171 profiler = ProfileRecorder(0.05)172 profiler.load_images(search_file, screen_file)173 profiler.profile_methods(["kaze", "brisk", "akaze", "orb", "sift", "surf", "brief"])174 profiler.wite_to_json(dir_path="result", file_name="high_dpi.json")175if __name__ == '__main__':...

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:

YouTube

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?

Helpful

NotHelpful