示例#1
0
 def __init__(self, serial, package, ui_device):
     super(Device, self).__init__()
     self.serial = serial
     self.package = package
     self.ui_device = ui_device
     self._adb = AdbTool(
     )  # serial, os.environ.get("PLATFORM_IP", "127.0.0.1")
示例#2
0
    def game_script_init(self, path):
        """
            将gametestlib.dll push到手机上的/data/local/tmp目录下
            然后调用gametestlib.dll中的GameTest.Test.init()方法
        :param path: gametestlib.dll, inject c# script
        :return:
        """
        logger.debug("push c# test script : {0}".format(path))
        result = AdbTool().cmd_wait("push", path, "/data/local/tmp/gametestlib.dll")
        logger.debug("push result : {0}".format(result))

        ret = self.socket.send_command(Commands.LOAD_TEST_LIB)
        return ret
示例#3
0
def _init_uiautomator():
    """
        初始化uiautomator
    :return:
    """
    file_path = os.path.split(os.path.realpath(__file__))[0]
    uiautomator_stub_path = os.path.abspath(
        os.path.join(file_path, "..","third","libs","uiAutomator","uiautomator-stub.jar"))
    adb=AdbTool()
    print(adb.cmd_wait("push",uiautomator_stub_path,"/data/local/tmp"))

    logger.debug("Start UIAutomator")
    uiautomator_process=adb.cmd("shell","uiautomator","runtest","uiautomator-stub.jar","-c","com.github.uiautomatorstub.Stub")
    time.sleep(3)
    logger.debug("Exit uiautomator")
    adb.forward(_uiautomator_port,_device_port)