monkeyRunner不能用
monkeyRunner不能用
最近在学自动化测试。但是发现windows下自带的monkeyrunner不能用了,
打开这个批处理文件看了看,发现里边的路径不太对。就挨个改了改,改完之后是这样的
setlocal
rem Set up prog to be the path of this script, including following symlinks,
rem and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0
rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces.
cd /d %~dp0
rem Check we have a valid Java.exe in the path.
set java_exe=
set sdk=C:\Users\jiakang\AppData\Local\Android\Sdk\
call ..\lib\find_java.bat
if not defined java_exe goto :EOF
for /f %%a in (“%APP_HOME%\lib\monkeyrunner-26.0.0-dev.jar”) do set jarfile=%%~nxa
set frameworkdir=.
set libdir=
if exist %frameworkdir%\%jarfile% goto JarFileOk
set frameworkdir=%sdk%tools\lib
if exist %frameworkdir%\%jarfile% goto JarFileOk
rem set frameworkdir=..\lib
:JarFileOk
set jarpath=%frameworkdir%\%jarfile%
if not defined ANDROID_SWT goto QueryArch
set swt_path=%ANDROID_SWT%
goto SwtDone
:QueryArch
rem for /f “delims=” %%a in (‘%frameworkdir%..\bin\archquery’) do set swt_path=%frameworkdir%\%%a
set swt_path=..\lib\x86_64
:SwtDone
if exist “%swt_path%” goto SetPath
echo SWT folder ‘%swt_path%’ does not exist.
echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
exit /B
:SetPath
echo %frameworkdir%
echo %jarpath%
call “%java_exe%” -Xmx512m “-Djava.ext.dirs=%frameworkdir%;%swt_path%” -Dcom.android.monkeyrunner.bindir=%sdk%platform-tools -jar %jarpath% %*
其中改了
- swt_path
- framework_dir
- -Dcom.android.monkeyrunner.bindir=%sdk%platform-tools
让我觉得诧异的是sdk里边的工具竟然会出这种问题,不知道谷歌是怎么想的。还是说这些功能其实根本没人用?(感觉是个坑)