Android CTS windows环境下测试

ITmantougan 2015-09-08

Windows下CTS测试步骤

1.获取CTS测试用例

1).从Google下载编译好的CTS测试用例

url:http://source.android.com/compatibility/downloads.html

2).或者编译CTS

i.到源码目录sourcebuild/envsetup.sh

ii.makects

iii.结果目录:~out/host/linux-x86/cts

2.制作脚本启动CTS

i).假设CTS目录结构为D:\cts\android-cts\tools….

ii).在cts目录下android-cts\tools中新建Start.bat

内容为:

@echooff

setCTS_ROOT=D:\cts

remsetRDBG_FLAG=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0暂不需用远程调试

setCTS_LIB=%CTS_ROOT%\android-cts\tools\cts-tradefed.jar

setDDM_LIB=%CTS_ROOT%\android-cts\tools\ddmlib-prebuilt.jar

setTDF_LIB=%CTS_ROOT%\android-cts\tools\tradefed-prebuilt.jar

setHST_LIB=%CTS_ROOT%\android-cts\tools\hosttestlib.jar

setJARS=%CTS_LIB%;%DDM_LIB%;%TDF_LIB%;%HST_LIB%

remechojava%RDBG_FLAG%-cp%JARS%-DCTS_ROOT=%CTS_ROOT%com.android.cts.tradefed.command.CtsConsole

calljava%RDBG_FLAG%-cp%JARS%-DCTS_ROOT=%CTS_ROOT%com.android.cts.tradefed.command.CtsConsole

rempause

@echoon

3.运行Start.bat,启动CTS命令窗口

4.执行CTS命令进行测试

获取测试计划命令:

listplans

获取包命令

listpackages

测试某计划命令

runcts--planplanName

测试某包命令

runcts--packagepackageName

'runcts--planCTS'torunthedefaultCTSplan

Someotherusefulcommandsare

Torunatestpackage:

'runcts--package<packagename>'

Torunatestclass:

'runcts--class<fulltestclassname>'

Toshardaplantestrunonmultipledevices

'runcts--planCTS--shards<numberofshards>

note:allconnecteddevicesmustberunningthesamebuild

Formoreoptions:

'runcts--help'

5.测试日志和测试记录分别放在android-cts\repository\Logs和android-cts\repository\Results目录下

6.单测某个方法

runcts-c类名-m方法名

相关推荐