批处理实现随机点击安卓设备的屏幕,可用于压力验证;
使用方法
将以下代码复制后,保存为*.bat批处理文件即可执行;或者新建一个记事本文件,将复制的代码粘贴进去,然后将文件名后缀改为*.bat,双击即可执行;
代码
@echo off
title Android Random touch test tool V1.0_20160714 by HRD
setlocal enabledelayedexpansion
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
echo Software Test Department
echo.
echo Android Random touch test tool V1.0_20160714 by HRD
echo.
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
echo note:
echo 接上安卓设备之前请确保已打开开发者选项中的“USB调试”功能。。。
echo Make sure before you connect the tablet is turned Developer options "USB debugging" feature. . .
echo.
:set1
echo 0 > count.dat
echo 请输入需要循环测试的次数=
set /p set1=Please input test cycle=
:start
color 1e
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo 等待安卓设备插入...
echo wait-for-device
adb wait-for-device
set /a x=%random%%%1000+1
set /a y=%random%%%500+1
echo X,Y=%x%,%y%
adb shell input touchscreen tap %x% %y%
::adb shell sleep 1
set /p count=<count.dat
set /a count= %count%+1
echo %count% PCS:
echo %count% >count.dat
for /f "delims=" %%a in (count.dat) do (set cishu=%%a)
if %cishu%==%set1% goto over
goto start
:over
echo %set1% PCS OK
echo Test Over ...
color 2f
PAUSE
goto set1