예제 #1
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._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._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]
예제 #2
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._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._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
        # 处理模拟器端口用的冒号
        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")

        if self._activityName == "":
            self._activityName = APK(self.get_apkpath()).activities[0]