0
点赞
收藏
分享

微信扫一扫

【adb】Andriod获取常用性能指标的方法

获取App的信息:

获取App信息

获取当前界面元素:adb shell dunpsys activity top

获取任务列表:adb shell dumpsys activity activities

获取App入口

adb logcat | grep -i displayed

aapt dump baadging mobike.apk | grep lunchable-activity

apkanalyzer 最新版本的SDK中才有

启动应用

adb shell am start -w -n com.xueqiu.android/.view.WelcomeActivityAlias -S

Android常用命令

adb:Android Debug Bridge

adb devices:查看设备

adb kill-server:关闭 adb 的后台进程

adb tcpip:让 Android 脱离 USB 线的 TCP 连接方式

adb connect:连接开启了 TCP 连接方式的手机

adb logcat:Android 日志查看

adb bugreport:收集日志数据,用于后续的分析,比如耗电量

adb shell

adb shell 本身就是一个 Linux 的 shell,可以调用 Android 内置命令
adb shell:

adb shell dumpsys

adb shell pm

adb shell am

adb shell ps

adb shell monkey

常用命令列表:

adb: adb install (apk)
pm:包管理工具,安装/卸载/清理包
adb shell pm clear com.xueqiu.android

am: 启动一个app
adb shell am start -n com.xueqiu.android
(adb shell am start -n com.xueqiu.android/.view.WelcomeActivityAlias -S)
dumpsys: 获取app性能数据,以及更多详细的信息

uiautomator: 获取app整体的界面结构,也可以执行一些自动化测试
adb shell uiautomator dump
adb shell “uiautomator dump && cat /文件名“
input: 完成一些简单的自动化指令
adb shell input
模拟一些触摸/键盘等操作事件
adb shell input tap 529 1176 #点击对应坐标的位置

Android性能统计dumpsys

获取所有的 dumpsys 子命令 dumpsys | grep -i DUMP

获取当前 activity adb shell dumpsys activity top

获取 activities 的记录,可以获取到 appium 依赖的原始 activity dumpsys activity activities

获取特定包基本信息 adb shell dumpsys package com.xueqiu.android

获取系统通知 adb shell dumpsys notification

获得内存信息 adb shell dumpsys meminfo com.android.settings

获取 cpu 信息 adb shell dumpsys cpuinfo

获取 gpu 绘制分析 adb shell dumpsys gfxinfo com.android.settings

获取短信 adb shell dumpsys activity broadcasts | grep senderName=

uiautomator

adb shell uiautomator runtest

adb shell uiautomator dumpsys

简单的自动化工具input命令

text

(Default: touchscreen)
keyevent [–longpress]

… (Default: keyboard)
tap

(Default: touchscreen)
swipe

[duration(ms)] (Default: touchscreen)
draganddrop

[duration(ms)] (Default: touchscreen)
press (Default: trackball)

roll

(Default: trackbal

Appium生态工具

adb:Android 的控制工具,用于获取 Android 的各种数据和控制

Appium Desktop:内嵌了 Appium Server 和 Inspector 的综合工具

Appium Server:Appium 的核心工具,命令行工具

Appium Clients:各种语言的客户端封装库,用于连接 appium server:
Java、Python、Ruby、robotframework-appium

AppCrawler 自动遍历工具

Appium desktop主要功能

UI 分析

录制用例

元素查找测试

Attach已有的session

云测试

录制用例并执行

使用 Appium Desktop 录制用例

安装 Python 依赖 pip install Appium-Python-Client

增加隐式等待增强稳定性

重新运行

举报

相关推荐

0 条评论