常用adb操作
恢复出厂设置
adb shell am broadcast -a android.intent.action.MASTER_CLEAR
卡刷升级
adb shell am broadcast -a android.intent.action.ONEKEY_UPGRADE
解锁
adb shell input keyevent 82
唤醒/休眠
adb shell input keyevent 26
输入文字
adb shell input text 10086
查看当前activity
adb shell dumpsys activity | grep mF
打开wifi
adb shell svc wifi enable
查看usb mode
adb shell svc usb getFunction
开启唤醒锁
adb shell echo 1 >/sys/power/wakelock
关闭唤醒锁
adb shell echo 1 >/sys/power/wakeunlock
设置时间
adb shell date -s +%c 061315232016.12
打开Activity
adb shell am start -n com.android.settings/.Settings\$AdvancedWifiSettingsActivity
发送短信
adb shell am start -a android.intent.action.SENDTO -d sms:10086 --es sms_body 123 --ez exit_on_sent true
打开wifi firmware log
wifi on状态下 dhdutil -i wlan0 dconpoll 10
常用一键操作
一键升级步骤
-
adb remount
-
adb push update.zip /cache 拷贝升级包
-
adb shell am broadcast -a android.intent.action.ONEKEY_UPGRADE
-
adb shell am broadcast -a android.intent.action.MASTER_CLEAR
Kill Monkey (Linux终端下)
adb shell kill “$(adb shell ps | grep monkey | awk '{print $2}')”
adb shell 下
kill “$(ps | grep monkey | tr -s [:space:] | cut -d ' ' -f 2)”
Kill Monkey (Uiautomator脚本)
adb shell uiautomator runtest test.jar -c com.sqa.Operate#killMonkey
Kill Uiautomator(Linux终端下)
adb shell kill “$(adb shell ps | grep uiautomator | awk '{print $2}')”
设置系统时间
echo 20160614150102 > /sys/class/rtc/rtc0/setrtc
确认Camera前后正常打开
1.adb shell am start -n com.android.camera2/com.android.camera.CameraLaun
Monkey测试步骤
-
一键升级
-
确认版本号 getDevicesInfo.sh
-
设置系统时间 setTime.sh (push.sh)
-
确认camera前后正常打开 checkCamera.sh
-
连接WIFI connectWIFI.sh
开启wifi日志
a.netcfg wlan0 up
b.dhdutil -i wlan0 dconpoll 10
c.netcfg wlan0 down
-
开启CPlog setCPSilentlog.sh
-
重启
-
开始测试
开关机测试
-
adb install AutoOnOff.apk
-
adb shell am start -n com.android.settings/.Settings\$SecuritySettingsActivity
-
adb shell uiautomator runtest test.jar -c com.sqa.Operate#clickText -e 1 Screen_lock -e 2 None
-
adb shell am start -n com.sqa.autoonoff/.MainActivity
-
adb shell uiautomator runtest test.jar -c com.sqa.Operate#clickText -e 1 Run
-
拔掉USB线