1. 程式人生 > >Android App專項測試

Android App專項測試

使用 row cfg table ext 信息 運行 spa adb命令

專項

概念

adb命令

App啟動時間

冷啟動

啟動app命令:

adb shell am start -W -n package/activity

停止app命令:

adb shell am force-stop package

獲取運行app包名:

adb logcat | grep START

熱啟動

啟動app命令:

adb shell am start -W -n package/activity

停止app命令:

adb shell input keyevent 3

CPU

查看cpu的資源占用:

Mac下:

adb shell dumpsys cpuinfo | grep packagename

Windows下:

adb shell dumpsys cpuinfo | findstr packagename

內存

獲取app進程ID:

adb shell ps | findstr pcakageName

查看App內存的占用:

adb shell top -n 1 -d 0.5 | findstr pid(進程ID)

流量

獲取進程ID指令:

adb shell ps | grep packagename

查看Android 設備的網卡信息:

adb shell netcfg

查看所有網卡流量:

adb shell cat /proc/pid/net/dev

獲取進程ID網卡流量:

adb shell cat /proc/ pid /net/dev | findstr wlan0

電量

設置手機為非充電狀態:

adb shell dumpsys battery set status 1

查看電量的使用情況:

adb shell dumpsys battery |findstr level

Android App專項測試