def __init__(self): # 准备数据 getConfig = datagetConfig() open_rgb = getConfig.getConfig().get("open_rgb") open_ir = getConfig.getConfig().get("open_ir") close_rgb = getConfig.getConfig().get("close_rgb") close_ir = getConfig.getConfig().get("close_ir") ai_stop = getConfig.getConfig().get("stop_reo") # 打开算法 ai_start = getConfig.getConfig().get("start_reo") # 关闭算法 eqt_port = getConfig.getConfig().get("equipment_port") # 获取设备串口号 # 引用公共方法 self.imgdis = images_dispose() self.ScreenFile = Screenshots_operation("打开关闭Camera测试结果") self.equipment_port = M20_serial(port=eqt_port, baudrate=115200) self.operation = Autoit_Upper_machine_function() self.windows_command = Command() # 处理命令ai self.open_Rgb = self.equipment_port.asc_str(open_rgb) self.open_Ir = self.equipment_port.asc_str(open_ir) self.close_Rgb = self.equipment_port.asc_str(close_rgb) self.close_Ir = self.equipment_port.asc_str(close_ir) self.stop_ai = self.equipment_port.asc_str(ai_stop) self.start_ai = self.equipment_port.asc_str(ai_start) # 创建图片存放地址 self.open_img = self.ScreenFile.create_file('打开摄像头测试结果图片') + "\\" self.close_img = self.ScreenFile.create_file('关闭摄像头测试结果图片') + "\\"
def __init__(self): '''批量添加图片测试''' # 引用方法类 self.ScreenFile = Screenshots_operation("批量添加底图测试结果") self.operation = Autoit_Upper_machine_function() self.imgdis = images_dispose() self.windows_command = Command() self.path_img = self.ScreenFile.create_file("连续添加批量图片截图文件") + "\\" # 创建图片存在的文件夹 self.library_img = self.ScreenFile.create_file("连续添加后数量截图文件") + "\\" # 创建图片存在的文件夹
def __init__(self, resultname): ''' 创建文件并且截图 ''' self.getConfig = datagetConfig() path = "D:\\test\\test_result\\log_%s" % resultname + time.strftime( '%m%d_%H%M%S') + '.txt' self.log = Logger(path, level='debug') self.upper_dis = Autoit_Upper_machine_function() self.img_dis = images_dispose()
def __init__(self): '''批量添加图片测试''' # 准备数据 getConfig = datagetConfig() power_port = getConfig.getConfig().get("relay_port")#获取继电器串口号 self.star_times = getConfig.getConfig().get("star_times")#重启等待时长 # 引用方法类 self.power_ser = M20_serial(port=power_port,baudrate =9600) self.ScreenFile = Screenshots_operation("批量添加底图测试结果") self.operation = Autoit_Upper_machine_function() self.imgdis = images_dispose() self.windows_command = Command() self.batch_power_img = self.ScreenFile.create_file("添加底图断电后重启截图文件") + "\\" # 创建图片存在的文件夹
def __init__(self): # 准备数据 getConfig = datagetConfig() self.star_times = getConfig.getConfig().get("star_times") # 等待时长 # 引用方法类 self.ScreenFile = Screenshots_operation("Bin文件升级测试结果") self.udis = Udisk_dispose() self.operation = Autoit_Upper_machine_function() self.imgdis = images_dispose() self.windows_command = Command() # 创建图片文件夹 self.vension_img = self.ScreenFile.create_file( "Bin升级版本截图") + "\\" # 创建图片存在的文件夹 self.upload_img = self.ScreenFile.create_file("Bin升级上传文件截图") + "\\" self.open_img = self.ScreenFile.create_file("Bin升级打开视频流件截图") + "\\"
import time from BI_SenseEngine.ShareScripts.Command import Command from BI_SenseEngine.windows_test_case.WindowsUpperButtonAutoit_mouse import Autoit_Upper_machine_function from BI_SenseEngine.ShareScripts.Screenshots_operation import Screenshots_operation from BI_SenseEngine.ShareScripts.images_dispose import images_dispose if __name__ == '__main__': '''批量添加图片测试''' # 准备数据 error_number = 0 successful_number = 0 text_max = 20000 # 引用方法类 ScreenFile = Screenshots_operation("单个添加底图测试结果") operation = Autoit_Upper_machine_function() imgdis = images_dispose() windows_command = Command() library_img = ScreenFile.create_file("单个添加后数量截图文件") + "\\" # 创建图片存在的文件夹 #开始测试 ScreenFile.log.logger.debug("-----------test start------------") # 启动上位机并选择串口 operation.init_start() #删除所有图片 operation.delete_all() # 开始测试 for i in range(1, text_max + 1): try: ScreenFile.log.logger.debug("--------test: %s---------" % i) operation.add_img("test_%s" % i) except Exception as e: error_number += 1