Beispiel #1
0
    def execute(self):
        case_id = input('请输入caseID:')
        task_id = input('请输入任务ID:')
        req = perfdog_pb2.ArchiveCaseToTaskReq(caseId=case_id, taskId=task_id)
        get_stub().archiveCaseToTask(req)

        return Quit()
Beispiel #2
0
    def execute(self):
        note_time = int(input('请输入标注时间戳:'))
        note_name = input('请输入标注名字:')
        req = perfdog_pb2.AddNoteReq(device=self.device, time=note_time, note=note_name)
        get_stub().addNote(req)

        return Quit()
Beispiel #3
0
    def execute(self):
        label_time = int(input('请输入标签时间戳:'))
        label_name = input('请输入标签名字:')
        req = perfdog_pb2.UpdateLabelReq(device=self.device, time=label_time, label=label_name)
        get_stub().updateLabel(req)

        return Quit()
Beispiel #4
0
    def execute(self):
        case_id = input('请输入caseID:')
        expire_time = int(input('请输入失效时间: '))
        req = perfdog_pb2.ShareCaseReq(caseId=case_id, expireTime=expire_time)
        print(get_stub().shareCase(req))

        return Quit()
Beispiel #5
0
 def execute(self):
     apps = get_apps(self.device)
     print_apps(apps)
     idx = int(input('请选择要获取进程列表的App:'))
     process_list = get_app_process_list(self.device, apps[idx])
     print_app_process_list(process_list)
     return Quit()
Beispiel #6
0
 def execute(self):
     apps = get_apps(self.device)
     print_apps(apps)
     idx = int(input('请选择要获取信息的App:'))
     pid_windows_map = get_app_pid_windows_map(self.device, apps[idx])
     print_app_pid_windows_map(pid_windows_map)
     return Quit()
Beispiel #7
0
    def execute(self):
        apps = get_apps(self.device)
        print_apps(apps)
        idx = int(input('请选择要测试的App:'))
        app = apps[idx]
        req = perfdog_pb2.UpdateAppInfoReq(device=self.device, app=app)
        print(get_stub().updateAppInfo(req))

        return Quit()
Beispiel #8
0
    def execute(self):
        server_url = input('请输入第三方数据上传服务地址:')
        print('0. json')
        print('1. pb')
        server_format = int(input('请选择要上传的格式:'))
        req = perfdog_pb2.SetDataUploadServerReq(serverUrl=server_url, dataUploadFormat=server_format)
        get_stub().setGlobalDataUploadServer(req)

        return Quit()
Beispiel #9
0
    def execute(self):
        case_id = input('请输入caseID:')
        expire_time = int(input('请输入失效时间: '))
        non_password = True if input('是否取消分享密码(y/n):') in 'yY' else False
        req = perfdog_pb2.ShareCaseReq(caseId=case_id,
                                       expireTime=expire_time,
                                       nonPassword=non_password)
        print(get_stub().shareCase(req))

        return Quit()
Beispiel #10
0
    def do_execute(self, device):
        req = perfdog_pb2.GetDeviceCacheDataReq(device=device)
        stream = get_stub().getDeviceCacheData(req)
        t = threading.Thread(target=self.run, args=(stream, ))
        t.start()
        input('')
        stream.cancel()
        t.join()

        return Quit()
Beispiel #11
0
    def execute(self):
        req = perfdog_pb2.OpenPerfDataStreamReq(device=self.device)
        stream = get_stub().openPerfDataStream(req)
        t = threading.Thread(target=self.run, args=(stream, ))
        t.start()
        input('')
        stream.cancel()
        t.join()

        return Quit()
Beispiel #12
0
    def do_execute(self, device):
        print('0. json')
        print('1. pb')
        data_format = int(input('请选择要拉取设备缓存数据格式:'))
        req = perfdog_pb2.GetDeviceCacheDataPackedReq(device=device, dataFormat=data_format)
        stream = get_stub().getDeviceCacheDataPacked(req)
        t = threading.Thread(target=self.run, args=(stream,))
        t.start()
        input('')
        stream.cancel()
        t.join()

        return Quit()
Beispiel #13
0
    def execute(self):
        class Listener:
            @staticmethod
            def on_add_device(device):
                print('Add Device:')
                print(device)

            @staticmethod
            def on_remove_device(device):
                print('Remove Device:')
                print(device)

        event_stream = get_device_manager().start_monitor(Listener())
        input('')
        get_device_manager().stop_monitor(event_stream)

        return Quit()
Beispiel #14
0
    def execute(self):
        class Listener:
            @staticmethod
            def on_add_device(device):
                print('Add Device:')
                print(device)

            @staticmethod
            def on_remove_device(device):
                print('Remove Device:')
                print(device)

        get_device_manager().set_device_listener(Listener())
        input('')
        get_device_manager().set_device_listener(None)

        return Quit()
Beispiel #15
0
    def execute(self):
        res = get_stub().getDeviceStatus(self.device)
        if res.isTesting:
            return True, TestContext(self.device)

        self.print_usage()
        idx = int(input('选择要测试的类型:'))

        if idx == 0:
            self.test_app()
        elif idx == 1:
            self.test_app_process()
        elif idx == 2:
            self.test_sys_process()
        else:
            return Quit()

        return True, TestContext(self.device)
Beispiel #16
0
    def do_execute(self, device):
        begin_time = int(input('请输入保存数据开始时间点:'))
        end_time = int(input('请输入保存数据结束时间点:'))
        case_name = input('请输入case名称:')
        is_upload = True if input('是否上传到云服务(y/n):') in 'yY' else False
        is_export = True if input('是否保存到本地(y/n):') in 'yY' else False
        print('0. excel')
        print('1. json')
        print('2. pb')
        output_format = int(input('请选择导出格式:'))
        req = perfdog_pb2.SaveDataReq(
            device=device,
            beginTime=begin_time,
            endTime=end_time,
            caseName=case_name,
            uploadToServer=is_upload,
            exportToFile=is_export,
            outputDirectory=PERFDOG_SERVICE_OUTPUT_DIRECTORY,
            dataExportFormat=output_format,
        )
        print(get_stub().saveData(req))

        return Quit()
Beispiel #17
0
    def execute(self):
        req = perfdog_pb2.SetDataUploadServerReq(serverUrl='')
        get_stub().setGlobalDataUploadServer(req)

        return Quit()
Beispiel #18
0
 def execute(self):
     req = perfdog_pb2.GetRenderResolutionReq(device=self.device)
     print(get_stub().GetRenderResolutionOfWindowUnderTest(req))
     return Quit()
Beispiel #19
0
    def execute(self):
        note_time = int(input('请输入标注时间戳:'))
        req = perfdog_pb2.RemoveNoteReq(device=self.device, time=note_time)
        get_stub().removeNote(req)

        return Quit()
Beispiel #20
0
 def do_execute(self, device):
     print(get_stub().getDeviceStatus(device))
     return Quit()
Beispiel #21
0
    def execute(self):
        label_name = input('请输入标签名字:')
        req = perfdog_pb2.SetLabelReq(device=self.device, label=label_name)
        print(get_stub().setLabel(req))

        return Quit()
Beispiel #22
0
    def execute(self):
        req = perfdog_pb2.StopTestReq(device=self.device)
        get_stub().stopTest(req)

        return Quit()
Beispiel #23
0
 def execute(self):
     get_device_manager().print_devices()
     return Quit()
Beispiel #24
0
 def execute(self):
     types = get_device_support_types(self.device)
     print_device_types(types)
     idx = int(input('请选择要关闭的类型:'))
     disable_device_type(self.device, types[idx])
     return Quit()
Beispiel #25
0
 def execute(self):
     types = get_device_types(self.device)
     print_device_types(types)
     return Quit()
Beispiel #26
0
 def do_execute(self, device):
     seconds = int(input('请输入截屏时间间隔:'))
     set_screenshot_interval(device, seconds)
     return Quit()
Beispiel #27
0
 def execute(self):
     print(get_stub().getDeviceInfo(self.device))
     return Quit()
Beispiel #28
0
 def execute(self):
     apps = get_apps(self.device)
     print_apps(apps)
     return Quit()
Beispiel #29
0
 def execute(self):
     preferences = perfdog_pb2.Preferences(doNotInstallPerfDogApp=False)
     req = perfdog_pb2.SetPreferencesReq(preferences=preferences)
     get_stub().setPreferences(req)
     return Quit()
Beispiel #30
0
 def execute(self):
     process_list = get_sys_process_list(self.device)
     print_sys_process_list(process_list)
     return Quit()