How to use _make_export_dir method in Airtest

Best Python code snippet using Airtest Github


Full Screen

...23def get_script_info(script_path):24 script_name = os.path.basename(script_path)25 result_json = {"name": script_name, "author": None, "title": script_name, "desc": None}26 return json.dumps(result_json)27def _make_export_dir(self):28 dirpath = self.script_root29 logpath = self.script_root30 # copy static files31 for subdir in ["css", "fonts", "image", "js"]:32 dist = os.path.join(dirpath, "static", subdir)33 shutil.rmtree(dist, ignore_errors=True)34 self.copy_tree(os.path.join(STATIC_DIR, subdir), dist)35 return dirpath, logpath36def report(self, template_name, output_file=None, record_list=None):37 """替换LogToHtml中的report方法"""38 self._load()39 steps = self._analyse()40 # 修改info获取方式41 info = json.loads(get_script_info(self.script_root))42 if self.export_dir:43 self.script_root, self.log_root = self._make_export_dir()44 output_file = os.path.join(self.script_root, HTML_FILE)45 self.static_root = "static/"46 if not record_list:47 record_list = [f for f in os.listdir(self.log_root) if f.endswith(".mp4")]48 records = [os.path.join(self.log_root, f) for f in record_list]49 if not self.static_root.endswith(os.path.sep):50 self.static_root = self.static_root.replace("\\", "/")51 self.static_root += "/"52 data = {}53 data['steps'] = steps54 data['name'] = os.path.basename(self.script_root)55 data['scale'] = self.scale56 data['test_result'] = self.test_result57 data['run_end'] = self.run_end...

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?