最近整理了一些自动化脚本今天来分享一下!
1.抓Log工具
@rem:抓Log工具
adb logcat -G 256M
adb logcat -c
adb logcat -v threadtime >D:/logs/logcase.txt
@rem:threadtime时间戳比time更精确一点
2.录屏工具
@rem:录屏工具,默认为180s
@rem:添加参数后可--time-limit 15设置录屏时间。例:adb shell screenrecord --time-limit 10 /sdcard/test.mp4
adb shell screenrecord --time-limit 15 /sdcard/demo.mp4
adb pull /sdcard/demo.mp4 D:/luping/demo.mp4
3.截屏工具
@rem:截屏工具只能单张截屏,不能重复点击使用,会覆盖上一张图片
adb shell /system/bin/screencap -p /sdcard/casetest.png
adb pull /sdcard/casetest.png D:/jieping/casetest.png
4.重复截屏工具
@rem:可重复截屏,不会覆盖!
%echo off
setlocal enabledelayedexpansion
set max=0
for %%x in (screenshot-*.png) do (
set "FN=%%~nx"
set "FN=!FN:screenshot-=!"
if !FN! GTR !max! set max=!FN!
)
set /a max+=1
adb shell /system/bin/screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png ./screenshot-%max%.png
5.等待adb连接后开始执行
@rem:等待adb连接后开始执行
adb wait-for-device
adb shell screenrecord /sdcard/demo.mp4
adb pull /sdcard/demo.mp4 D:/luping/demo.mp4
6.重启测试
for /l %%i in (1,1,10) do (
adb reboot & timeout /t 34 & @echo %%i
)
pause
exit
7.Monkey
adb shell monkey -v -v -v -s 8888 --throttle 3000 --pct-touch 30 --pct-motion 20 --pct-appswitch 20 --pct-majornav 5 --pct-nav 5 --pct-trackball 5 --ignore-crashes --ignore-timeouts --monitor-native-crashes 10000