def run(self, cases): start_time = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())) devices = check_devives() if not devices: print('There is no device found,test over.') return # generate test data data.json 准备测试数据 generate_test_data(devices) print('Starting Run test >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') runs = [] for i in range(len(devices)): runs.append(RunCases(devices[i])) # run on every device 开始执行测试 pool = Pool(processes=len(runs)) for run in runs: pool.apply_async(self._run_cases, args=( run, cases, )) print('Waiting for all runs done........ ') pool.close() pool.join() print('All runs done........ ') ChromeDriver.kill() # Generate statistics report 生成统计测试报告 将所有设备的报告在一个HTML中展示 create_statistics_report(runs) backup_report('./TestReport', './TestReport_History', start_time)
def run(self, cases): # 根据method 获取android设备 method = ReadConfig().get_method().strip() if method == 'SERVER': # get ATX-Server Online devices # devices = ATX_Server(ReadConfig().get_server_url()).online_devices() print('Checking available online devices from ATX-Server...') devices = get_online_devices() print('\nThere has %s online devices in ATX-Server' % len(devices)) elif method == 'IP': # get devices from config devices list print('Checking available IP devices from config... ') devices = get_devices() print('\nThere has %s devices alive in config IP list' % len(devices)) elif method == 'USB': # get devices connected PC with USB print('Checking available USB devices connected on PC... ') devices = connect_devices() print('\nThere has %s USB devices alive ' % len(devices)) else: raise Exception('Config.ini method illegal:method =%s' % method) if not devices: print('There is no device found,test over.') return # generate test data data.json 准备测试数据 generate_test_data(devices) print('Starting Run test >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') runs = [] for i in range(len(devices)): runs.append(RunCases(devices[i])) # run on every device 开始执行测试 pool = Pool(processes=len(runs)) for run in runs: pool.apply_async(self._run_cases, args=( run, cases, )) print('Waiting for all runs done........ ') pool.close() pool.join() print('All runs done........ ') ChromeDriver.kill() # Generate statistics report 生成统计测试报告 将所有设备的报告在一个HTML中展示 create_statistics_report(runs)