def __init__(self,mdevice=""): #获取当前文件的上层路径 self._parentPath=os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())) + os.path.sep + ".") #获取当前项目的根路径 self._rootPath=os.path.abspath(os.path.dirname(self._parentPath) + os.path.sep + ".") self._configPath=self._rootPath+"\config.ini" self._devicesList = Config.getValue(self._configPath, "deviceslist", ) self._packagePath = Config.getValue(self._configPath, "apkpath")[0] self._packageName = Config.getValue(self._configPath, "packname")[0] self._activityName = Config.getValue(self._configPath, "activityname")[0] self._needClickInstall = Config.getValue(self._configPath, "needclickinstall")[0] self._needClickStartApp = Config.getValue(self._configPath, "needclickstartapp")[0] self._startTime=time.time() self._timeoutAction=int(Config.getValue(self._configPath, "timeoutperaction")[0]) self._timeoutStartApp=int(Config.getValue(self._configPath, "timeoutofstartapp")[0]) self._mdevice=mdevice # 处理模拟器端口用的冒号 if ":" in self._mdevice: self._nickName = self._mdevice.split(":")[1] else: self._nickName=self._mdevice self._iteration=int(Config.getValue(self._configPath, "iteration")[0]) self._allTestcase=Config.getValue(self._configPath, "testcase") try: self._testcaseForSelfDevice =Config.getTestCase(self._configPath, self._nickName) if self._testcaseForSelfDevice[0]=="": self._testcaseForSelfDevice = self._allTestcase except Exception: self._testcaseForSelfDevice=self._allTestcase self._testCasePath=Config.getValue(self._configPath, "testcasepath") if self._testCasePath[0]=="": self._testCasePath=os.path.join(self._rootPath, "TestCase") self._needPerformance=Config.getValue(self._configPath,"needPerformance")[0] if self._activityName=="": self._activityName=APK(self.get_apkpath()).activities[0]
def __init__(self, mdevice=""): # 获取当前文件的上层路径 self._parentPath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())) + os.path.sep + ".") # 获取当前项目的根路径 self._rootPath = os.path.abspath(os.path.dirname(self._parentPath) + os.path.sep + ".") self._devicesList = data['devices_list'] self._packagePath = data['apkpath'] self._packageName = data['packname'] self._activity = data['activity'] self._mdevice = mdevice # 处理模拟器端口用的冒号 if ":" in self._mdevice: self._nickName = self._mdevice.split(":")[1] else: self._nickName = self._mdevice self._allTestcase = data['testcase'] try: app_nick = 'app' + self._nickName self._testcaseForSelfDevice = Config.getTestCase(data['TestCaseforDevice'][app_nick]) if self._testcaseForSelfDevice == "": self._testcaseForSelfDevice = self._allTestcase except Exception: self._testcaseForSelfDevice = self._allTestcase self._testCasePath = data['testcasepath'] if self._testCasePath is None: self._testCasePath = os.path.join(self._rootPath, "TestCase")
def __init__(self, mdevice=""): #获取当前文件的上层路径 self._parentPath = os.path.abspath( os.path.dirname(inspect.getfile(inspect.currentframe())) + os.path.sep + ".") #获取当前项目的根路径 self._rootPath = os.path.abspath( os.path.dirname(self._parentPath) + os.path.sep + ".") self._configPath = self._rootPath + "\config.ini" self._devicesList = Config.getValue( self._configPath, "deviceslist", ) self._packageName = Config.getValue(self._configPath, "packname")[0] self._activityName = Config.getValue(self._configPath, "activityname")[0] self._skip_pushapk2devices = Config.getValue(self._configPath, "skip_pushapk2devices")[0] self._auto_delete_package = Config.getValue(self._configPath, "auto_delete_package")[0] self._auto_install_package = Config.getValue(self._configPath, "auto_install_package")[0] self._skip_check_of_install = Config.getValue( self._configPath, "skip_check_of_install")[0] self._skip_check_of_startapp = Config.getValue( self._configPath, "skip_check_of_startapp")[0] self._skip_performance = Config.getValue(self._configPath, "skip_performance")[0] self._storage_by_excel = Config.getValue(self._configPath, "storage_by_excel")[0] self._screenoff = Config.getValue(self._configPath, "screenoff")[0] self._startTime = time.time() self._timeout_of_per_action = int( Config.getValue(self._configPath, "timeout_of_per_action")[0]) self._timeout_of_startapp = int( Config.getValue(self._configPath, "timeout_of_startapp")[0]) self._mdevice = mdevice self._poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False) # 处理模拟器端口用的冒号 if ":" in self._mdevice: self._nickName = self._mdevice.split(":")[1] else: self._nickName = self._mdevice self._iteration = int( Config.getValue(self._configPath, "iteration")[0]) self._allTestcase = Config.getValue(self._configPath, "testcase") try: self._testcaseForSelfDevice = Config.getTestCase( self._configPath, self._nickName) if self._testcaseForSelfDevice[0] == "": self._testcaseForSelfDevice = self._allTestcase except Exception: self._testcaseForSelfDevice = self._allTestcase self._testCasePath = Config.getValue(self._configPath, "testcasepath") if self._testCasePath[0] == "": self._testCasePath = os.path.join(self._rootPath, "TestCase")
def __init__(self, mdevice=""): # 获取当前文件的上层路径 self._parentPath = os.path.abspath( os.path.dirname(inspect.getfile(inspect.currentframe())) + os.path.sep + ".") # 获取当前项目的根路径 self._rootPath = os.path.abspath( os.path.dirname(self._parentPath) + os.path.sep + ".") self._configPath = self._rootPath + "\config.ini" # 获取项目名称 self._pro_name = Config.getProName(self._configPath, "pro_name") # 获取项目配置 self._jenkins_url = Config.getProConfig(self._configPath, 'jenkins_url', self._pro_name)[0] self._devicesList = Config.getProConfig(self._configPath, "deviceslist", self._pro_name) self._packagePath = Config.getProConfig(self._configPath, "apkpath", self._pro_name)[0] self._packageName = Config.getProConfig(self._configPath, "packname", self._pro_name)[0] self._activityName = Config.getProConfig(self._configPath, "activityname", self._pro_name)[0] # 获取基本配置 self._skip_pushapk2devices = Config.getBasicConfig( self._configPath, "skip_pushapk2devices") self._auto_delete_package = Config.getBasicConfig( self._configPath, "auto_delete_package") self._auto_install_package = Config.getBasicConfig( self._configPath, "auto_install_package") self._skip_check_of_install = Config.getBasicConfig( self._configPath, "skip_check_of_install") self._skip_check_of_startapp = Config.getBasicConfig( self._configPath, "skip_check_of_startapp") self._skip_generate_report = Config.getBasicConfig( self._configPath, "skip_generate_report") self._skip_email = Config.getBasicConfig(self._configPath, "skip_email") self._skip_performance = Config.getBasicConfig(self._configPath, "skip_performance") self._storage_by_excel = Config.getBasicConfig(self._configPath, "storage_by_excel") self._startTime = time.time() self._timeout_of_per_action = int( Config.getBasicConfig(self._configPath, "timeout_of_per_action")) self._timeout_of_startapp = int( Config.getBasicConfig(self._configPath, "timeout_of_startapp")) self._mdevice = mdevice # 处理模拟器端口用的冒号 if ":" in self._mdevice: self._nickName = self._mdevice.split(":")[1] else: self._nickName = self._mdevice self._iteration = int( Config.getBasicConfig(self._configPath, "iteration")) self._allTestcase = Config.getProConfig(self._configPath, "testcase", self._pro_name) try: self._testcaseForSelfDevice = Config.getTestCase( self._configPath, self._pro_name, self._nickName) if self._testcaseForSelfDevice[0] == "": self._testcaseForSelfDevice = self._allTestcase except Exception: self._testcaseForSelfDevice = self._allTestcase self._testCasePath = Config.getProConfig(self._configPath, "testcasepath", self._pro_name) if self._testCasePath[0] == "": self._testCasePath = os.path.join(self._rootPath, "TestCase") if self._activityName == "": if self._skip_check_of_install == 0: self._activityName = APK(self.get_apkpath()).activities[0]