欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Android CTS windows环境下测试

程序员文章站 2024-01-17 16:55:46
...
Windows下CTS测试步骤
1.获取CTS 测试用例
1).从Google下载编译好的CTS测试用例
url : http://source.android.com/compatibility/downloads.html
2).或者编译CTS
i.到源码目录 source build/envsetup.sh
ii.make cts
iii.结果目录:~out/host/linux-x86/cts
2.制作脚本启动CTS
i).假设CTS目录结构为D:\cts\android-cts\tools….
ii).在cts目录下android-cts\tools中新建Start.bat
内容为:
@echo off
set CTS_ROOT=D:\cts
rem set RDBG_FLAG=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0 暂不需用远程调试
set CTS_LIB=%CTS_ROOT%\android-cts\tools\cts-tradefed.jar
set DDM_LIB=%CTS_ROOT%\android-cts\tools\ddmlib-prebuilt.jar
set TDF_LIB=%CTS_ROOT%\android-cts\tools\tradefed-prebuilt.jar
set HST_LIB=%CTS_ROOT%\android-cts\tools\hosttestlib.jar
set JARS=%CTS_LIB%;%DDM_LIB%;%TDF_LIB%;%HST_LIB%
rem echo java %RDBG_FLAG% -cp %JARS% -DCTS_ROOT=%CTS_ROOT% com.android.cts.tradefed.command.CtsConsole
call java %RDBG_FLAG% -cp %JARS% -DCTS_ROOT=%CTS_ROOT% com.android.cts.tradefed.command.CtsConsole
rem pause
@echo on
3.运行Start.bat,启动CTS命令窗口
4.执行CTS命令进行测试
获取测试计划命令:
list plans
获取包命令
list packages
测试某计划命令
run cts - -plan planName
测试某包命令
run cts - -package packageName

'run cts --plan CTS' to run the default CTS plan

Some other useful commands are

To run a test package:
'run cts --package <packagename>'

To run a test class:
'run cts --class <full test class name>'

To shard a plan test run on multiple devices
'run cts --plan CTS --shards <number of shards>
note: all connected devices must be running the same build

For more options:
'run cts --help'

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

6.单测某个方法
run cts -c 类名 -m 方法名