def run_method_H5(driver_name, sheetN): total_count = [] # 总数 data = Getda(sheetN) server = Serappium() server.main() # 启动appium服务 action_method = ActionMeSelenium(driver_name, sheetN) caselines = data.get_case_lines() start = datetime.datetime.now() print("------------start time used---------------:", start) for i in range(1, caselines): is_run = data.get_is_run(i) if is_run is True: handle_step = data.get_handle_step(i) # 执行方法 handle_value = data.get_handle_value(i) # 操作值 # 自动化测试用例集执行 excute_method = getattr(action_method, handle_step) print( '-------------------------执行到行数-------------------------', i) time.sleep(2) excute_method(i, handle_value) action_method.ScreenShot(i, handle_value, file_s='../Image/H5_img/执行图片/') total_count.append(i) end = datetime.datetime.now() print("------------Time used---------------:", end - start) total = len(total_count) return total
def Run_Thread_Sport_Android(self): """ 体育项目 体育对投 多进程 :return: """ server = Serappium() server.main() # 启动appium服务 Run_threads = [ multiprocessing.Process(target=self.Run_BB_Android), # multiprocessing.Process(target=self.Run_Sport_Android2) ] for run_t in Run_threads: run_t.start()
def Run_Thread_BB_H5Android(self): """ BB项目 Android H5 多进程 :return: """ server = Serappium() server.main() # 启动appium服务 Run_threads = [ multiprocessing.Process(target=self.Run_BB_Android), multiprocessing.Process(target=self.Run_BB_H5) ] for run_t in Run_threads: run_t.start()
体育项目 体育对投 多进程 :return: """ server = Serappium() server.main() # 启动appium服务 Run_threads = [ multiprocessing.Process(target=self.Run_BB_Android), # multiprocessing.Process(target=self.Run_Sport_Android2) ] for run_t in Run_threads: run_t.start() def run_All(self): Run_threads = [ multiprocessing.Process(target=self.Run_Thread_Sport_Android), multiprocessing.Process(target=self.Run_Thread_BB_H5Android) ] for run_t in Run_threads: run_t.start() run_t.join() if __name__ == '__main__': c = AllThread() server = Serappium() server.main() # 启动appium服务 c.Run_Thread_Sport_Android()
def run_method_All(driver_name, sheetN, Run_name, i_num=None, appname=None, time_sleep=None): global action_method, action_method_selenium total_count = [] # 总数 data = Getda(sheetN) if Run_name == 'ios': action_method = ActionMe(driver_name, sheetN, i_num, appname) elif Run_name == 'android': action_method = ActionMe(driver_name, sheetN, i_num, appname) elif Run_name == 'H5': action_method_selenium = ActionMeSelenium(driver_name, sheetN, i_num) elif Run_name == 'web': action_method_selenium = ActionMeSelenium(driver_name, sheetN) caselines = data.get_case_lines() start = datetime.datetime.now() print("------------start time used---------------:", start) print( '---------------------------------------------------------------------------1234567----------------' ) for i in range(1, caselines): data.write_value(i, "") # 清空单元格 is_run = data.get_is_run(i) if is_run is True: handle_step = data.get_handle_step(i) # 执行方法 handle_value = data.get_handle_value(i) # 操作值 # 自动化测试用例集执行 if Run_name == 'android': excute_method = getattr(action_method, handle_step) print( '--------------{0}--*************移动端----执行到行数-------------------------' .format(sheetN), i) else: excute_method = getattr(action_method_selenium, handle_step) time.sleep(time_sleep) if Run_name == 'android': action_method.ScreenShot(i, handle_value, file_s='../Image/' + Run_name + '/执行图片/') else: action_method_selenium.ScreenShot(i, handle_value, file_s='../Image/' + Run_name + '/执行图片/') total_count.append(i) end = datetime.datetime.now() print("------------Time used---------------:", end - start) server1 = Serappium() server1.kill_server() total = len(total_count) return total