def runner(): i=1 while True: kill_adb() devicess = AndroidDebugBridge().attached_devices() if len(devicess) > 0: mk_file() l_devices = [] for dev in devicess: app = {} app["devices"] = dev init(dev) app["port"] = str(random.randint(4700, 4900)) app["bport"] = str(random.randint(4700, 4900)) app["systemPort"] = str(random.randint(4700, 4900)) app["app"] = PATH("../app/com.jm.android.jumei_8.601_8601.apk") # 测试的app路径 #app["app"] = "/Users/vic/work/WORK/Work/Py_script/appium-master/app/android-system-webview-60.apk" # 测试的app路径,喜马拉雅app l_devices.append(app) appium_server = AppiumServer(l_devices) appium_server.start_server() #print(l_devices) runnerPool(l_devices) writeExcel() filepath = PATH("../Report/ReportDetail.xlsx") excel_to_html(filepath) appium_server.stop_server(l_devices) data = getData() if data["pass"] >0: print("执行成功,发送邮件") isSend() break else: time.sleep(5) i+=1 if i==4: print("执行失败") break print("执行失败重试三次,第" + str(i) + "次......") else: print("没有可用的安卓设备") break
devicess = get_ios_devices() if len(devicess) > 0: mk_file('iOS') l_devices = [] for dev in devicess: app = {} app["devices"] = dev app["port"] = str(random.randint(4700, 4900)) app["bport"] = str(random.randint(4700, 4900)) app["app"] = BaseInit.ipaPath l_devices.append(app) appium_server = AppiumServer(l_devices) appium_server.start_server() runnerPool(l_devices) writeExcel() appium_server.stop_server(l_devices) # 删除temp文件 remove_file(PATH("../yamls/temp.yaml")) print("============开始导出crashreport==========") find_str = 'XiaoYing-' # 待测app crashreport文件关键字 file_format1 = [".ips"] # 导出的crash文件后缀 file_format2 = [".crash"] # 解析后的crash文件后缀 reportPath = PATH("../Log/CrashInfo/iOS/") beforePath = os.path.join(reportPath + '/Before') if not os.path.exists(beforePath):
unittest.TextTestRunner(verbosity=2).run(suite) endtime = datetime.now() countDate(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), str((endtime - starttime).seconds) + "秒") if __name__ == '__main__': kill_adb() devicess = AndroidDebugBridge().attached_devices() if len(devicess) > 0: mk_file() l_devices = [] for dev in devicess: app = {} app["devices"] = dev init(dev) app["port"] = str(random.randint(4700, 4900)) app["bport"] = str(random.randint(4700, 4900)) app["systemPort"] = str(random.randint(4700, 4900)) app["app"] = PATH("../app/com.ximalaya.ting.android.apk") # 测试的app路径,喜马拉雅app l_devices.append(app) appium_server = AppiumServer(l_devices) appium_server.start_server() runnerPool(l_devices) writeExcel() appium_server.stop_server(l_devices) else: print("没有可用的安卓设备")