ip = "10.9.66.28:8888" bin_name = 'm20_V2.5.0_update_tar.bin' test_max = 250 uvc_flag1 = True # 先创建测试结果文件夹,里面存放log、截图等跟测试结果有关的文件 result_files = File_operations() # 实例化文件操作对象,用于测试结果相关文件的操作 path = result_files.create_floder("固件升级测试log", 'D:\\test-project\\007-M10_M20\\scripts-test-result') # 在当前路径下创建测试结果文件夹,用于存放测试结果相关文件 print(path) upload_fail_paths = result_files.create_floder('固件升级失败截图', 'D:\\test-project\\007-M10_M20\\scripts-test-result') # + "\\" print(upload_fail_paths) start_path = result_files.create_floder('升级后打开预览界面截图', 'D:\\test-project\\007-M10_M20\\scripts-test-result') # + "\\" print(start_path) D = SenseEngineCameraDemoDebugApk(ip, path) adb = AdbOpt(ip) for i in range(139, test_max+1): adb.adb_rm_files('/sdcard/Pictures/*.jpg') # 删除在预览界面主动上报的图,防止占用内存 uvc_load_starttime = time.time() while uvc_flag1: adb.adb_exist() # 检测adb是否连接 uvc_flag_list = ['ttyACM0', 'ttyACM1', 'ttyACM2'] #先确认UVC节点已经挂载成功,在操作安卓上位机 checkUvc_info = os.popen('adb -s %s shell ls /dev -all'%ip).read() #print(checkUvc_info) for a in uvc_flag_list: uvc_flag = checkUvc_info.find(a) if uvc_flag != -1: uvc_load_endtime = time.time() print('Uvc 已经挂载成功!!!') uvc_flag1 = False
# coding: utf-8 import uiautomator2 as u2 import time import autoit import os from sensetimebi_productstests.Sharedscript.SharedSerial import SingleRelay from sensetimebi_productstests.Sharedscript.SharedAdbOperation import AdbOpt from sensetimebi_productstests.Sharedscript.logger import Logger if __name__ == '__main__': ipport = '10.9.40.25:8888' log = Logger( 'D:\\test-project\\000-testScripts\\sensetimebi_productstests\\BI_RK_SensePass020\\111.txt', level='debug') # 保存脚本运行log d = u2.connect_adb_wifi(ipport) # 连接安卓设备 adb = AdbOpt(ipport) relay = SingleRelay('com37', 9600) for i in range(109, 2000): log.logger.debug('————————test:%s————————' % i) relay.connect_power() # 等待设备开机 time.sleep(20) adb.adb_screencap(i, 'D:\\test-project\\009-火神mini\\不出流') time.sleep(1) relay.disconnect_power() # 给设备上电 time.sleep(5 * 60) #给设备下电