(1)-windows下cts配置

最后更新于:2022-04-01 06:54:21

# 环境搭建 ## 下载 cts工具的下载地址:[http://source.android.com/compatibility/downloads.html](http://source.android.com/compatibility/downloads.html) windows选择[Android4.4 R3 Compatibility Test Suite (CTS) - ARM](https://dl.google.com/dl/android/cts/android-cts-4.4_r3-linux_x86-arm.zip)下载。 ## 目录结构 解压后的目录结构如下: ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc1caea9.jpg) 其中repository和tools以后会经常用到,介绍一下. ### repository 进入repository目录后,会有四个文件 ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc1e02f5.jpg) logs:存放case执行过程中的log文件或者截图 plans:配置plan的xml文件存放处,自带以下plan ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc20cc90.png) results:结果文件 testcases:case存放目录,自带如下case ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc231484.jpg) ## tools 工具的执行目录: ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc37e370.jpg) 包含了所需的jar包和一个linux下可执行的shell文件。 ## 运行 工具想要在windows下执行,需要在tools下添加一个windows下可执行的文件:[cts-tradefed.bat](http://download.csdn.net/detail/qhshiniba/8048255) ~~~ @echo off setlocal enabledelayedexpansion setlocal ENABLEEXTENSIONS ::设置cts根目录,更改当前目录为批处理本身的目录 set CTS_ROOT=%~dp0\..\.. ::设置支持的jar包的根目录 set JAR_DIR=%CTS_ROOT%\android-cts\tools ::支持的jar包,一下项目中引用的jar包都要在启动的时候包含进来 set JARS=ddmlib-prebuilt.jar tradefed-prebuilt.jar hosttestlib.jar cts-tradefed.jar tradefed-prebuilt-orgin.jar jsoup-1.7.3.jar gson-2.2.4.jar commons-compress-1.8.1.jar mail.jar javacsv.jar RXTXcomm.jar set JAR_PATH=. for %%i in (%JARS%) do ( set JAR_PATH=!JAR_PATH!;%%i ) java %RDBG_FLAG% -cp %JAR_PATH% -DCTS_ROOT=%CTS_ROOT% com.android.cts.tradefed.command.CtsConsole %* pause ~~~ 添加后目录结构如下: ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc39b834.jpg) 插上手机,点击cts-tradefed.bat文件启动cts,会出现如下界面: ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc3c2c4c.jpg) 运行一个测试试试: ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc3d8e91.jpg) 现在你回头去看之前的respository目录的logs和results目录里会多了一个文件: ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc431165.jpg)![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc45662f.jpg) 等收集完手机信息后会启动测试,如下图: ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc46d4d4.jpg) ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc48d908.jpg) 结束后去repository/results/下查看结果,点击testResult.xml文件,会在浏览器里打开统计数据: ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-09_56911dc4b67ca.jpg)
';