使用腳本來執行測試的特點:
●書寫方便
●基本上可以實現90%以上的功能性覆蓋
●測試結果需要通過自己觀察整個過程和日志文件來得出的
●有些外部的動作,腳本是無法實現的,比如錄入指紋
●只適配特定尺寸的設備
●沒法對內容進行校驗
●執行命令間隔時間要把控好
常用命令
1、打電話
adb shell am start -a android.intent.action.CALL -d tel:10086
2、打開QQ
adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
3、打開微信
adb shell am start com.tencent.mm/com.tencent.mm.ui.LauncherUI
4、打開支付寶
adb shell am start com.eg.android.AlipayGphone/.AlipayLogin
5、殺死支付寶
adb shell am force-stop com.eg.android.AlipayGphone
6、關閉QQ
adb shell am force-stop com.tencent.mobileqq
7、點擊事件
adb shell input tap 500 500
8、home鍵
adb shell input keyevent 3
9、返回鍵
adb shell input keyevent 4
10、截圖(保存到sdcard)
adb shell /system/bin/screencap -p /sdcard/screenshot.png
11、錄屏
adb shell screenrecord /sdcard/test.mp4
adb pull /sdcard/test.mp4 /Users/dhht/Desktop/test.mp4
12、亮屏
adb shell input keyevent 26
13、上下滑動
adb shell input swipe 700 2000 700 1000
14、左右滑動
adb shell input swipe 100 1000 1000 1000