CTS 使用手册09Word文档下载推荐.docx

上传人:b****1 文档编号:1446369 上传时间:2023-04-30 格式:DOCX 页数:33 大小:107.82KB
下载 相关 举报
CTS 使用手册09Word文档下载推荐.docx_第1页
第1页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第2页
第2页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第3页
第3页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第4页
第4页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第5页
第5页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第6页
第6页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第7页
第7页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第8页
第8页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第9页
第9页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第10页
第10页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第11页
第11页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第12页
第12页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第13页
第13页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第14页
第14页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第15页
第15页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第16页
第16页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第17页
第17页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第18页
第18页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第19页
第19页 / 共33页
CTS 使用手册09Word文档下载推荐.docx_第20页
第20页 / 共33页
亲,该文档总共33页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

CTS 使用手册09Word文档下载推荐.docx

《CTS 使用手册09Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《CTS 使用手册09Word文档下载推荐.docx(33页珍藏版)》请在冰点文库上搜索。

CTS 使用手册09Word文档下载推荐.docx

性能:

启动时间:

浏览器<

1300ms

MMS/SMS<

700ms

AlarmClock<

650ms

第二次启动一个应用的时间不能超过第一次启动时间。

CTS测试:

必须通过最新的CTS

升级:

必须有一种办法可以升级全系统。

可以为:

OTA

USB

SD卡

看来Android是在不断往高端方向走。

不过想想也正常,今天的高端就是明天的低端!

二、CTS的安装和运行

1.安装CTS

首先,我们可以通过git下载cts源码,放在你的android源码根目录下。

如果你的源码中已经有cts就不用下载了。

gitrepositoryhttp:

//android.git.kernel.org/?

p=platform/cts.git;

a=summary

$cd$MYDROID//你的源码根目录

$.build/envsetup.sh

$makects

(itwouldgeneratealltestplans,packages,cases,resultreportformatandthenziptoaandroid-cts.zipfile)

∙PackageCTS:

out/host/linux-x86/cts/android-cts.zip

∙ctsmakefile:

$MYDROID/build/core/tasks/cts.mk

∙runctsprogram:

$MYDROID/out/host/linux-x86/bin/cts

∙testplans:

$MYDROID/out/host/linux-x86/cts/android-cts/repository/plans

∙testpackages:

$MYDROID/out/host/linux-x86/cts/android-cts/repository/testcases

∙testresults:

$MYDROID/out/host/linux-x86/cts/android-cts/repository/results

∙CTSprogramsettingsvalue:

$MYDROID/cts/tools/utils/host_config.xml

2.运行CTS

runcts

$cd$MYDROID/out/host/linux-x86/bin/

$./cts

注意如果用手机设备调试,用root权限执行

1)运行整个cts测试

$cts_host>

start--planCTS

2)选择运行某个plan:

cts_host>

start--planVM

运行结果如下:

starttestplanVM

==============================================================

Testpackage:

android.core.vm-tests

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testB1......(pass)

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testB2.....(pass)

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testB3....(pass)

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testB4....(pass)

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testB5....(pass)

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testB6....(pass)

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testB7....(pass)

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testB8....(pass)

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testB9....(pass)

dot.junit.opcodes.add_double_2addr.JUnit_Test_add_double_2addr#testN1...^C(pass)

注:

ls--plan列出所有plan

start--plan***运行某个plan

还有很多命令可以参看网络资料

3.结果

测试结果在mydroid/out/host/linux-x86/cts/android-cts/repository/results目录下,

以网页显示所有测试结果,如下图所示:

三、CTS架构下增加新的测试计划

1.添加新的测试包源代码到CTS文件夹下

在源码下有些已经写好的testcase,我们只需要做些移植

(Junit架构下的单元测试代码可以在许多模块的源代码和src平行的test目录里,也是被封装为一个apk的应用)

$cp-a$MYDROID/packages/apps/Music/tests$MYDROID/cts/tests/tests/MusicTests

ModifytestpackagenameinAndroid.mktoavoidredundantname

$gedit$MYDROID/cts/tests/tests/MusicTests/Android.mk

LOCAL_PATH:

=$(callmy-dir)

include$(CLEAR_VARS)

#Weonlywantthisapkbuildfortests.

LOCAL_MODULE_TAGS:

=tests

LOCAL_JAVA_LIBRARIES:

=android.test.runner

#Includealltestjavafiles.

LOCAL_SRC_FILES:

=$(callall-java-files-under,src)

LOCAL_PACKAGE_NAME:

=MusicTestsCases

LOCAL_INSTRUMENTATION_FOR:

=Music

include$(BUILD_PACKAGE)

2.添加新的测试用例

更改cts.mk文件

#gedit$MYDROID/build/core/tasks/cts.mk

CtsTargetInstrumentationApp\

CtsUsePermissionDiffCert

CTS_CASE_LIST:

=\

TestDeviceSetup\

CtsTestStubs\

MusicTestsCases\

CtsAccountManagerTestCases\

CtsAppTestCases\

CtsBluetoothTestCases\

CtsContentTestCases\

CtsDatabaseTestCases\

CtsDpiTestCases\

3.添加测试计划到文件中

#gedit$MYDROID/cts/tools/utils/buildCts.py

defGenerateTestPlans(self):

.....

plan=tools.TestPlan(packages)

plan.Include(r'

android\.MusicTests'

self.__WritePlan(plan,'

MusicTests'

4.重新编译CTS

4.1正常情况下运行CTS

$cd$MYDROID

 

runMusicTestCases

$cd$mydroid/out/host/linux-x86/bin/

start--planMusicTests//如果运行不成功可以尝试下面的方法

starttestplanMusicTests

android.MusicTests

installmetfailure[install_failed_insufficient_storage]

com.android.music.tests.stress.AlbumsPlaybackStress#testAlbumPlay.....(pass)

com.android.music.tests.stress.AlbumsPlaybackStress#testActivityTestCaseSetUpProperly....(pass)

com.android.music.tests.stress.MusicPlaybackStress#testPlayAllSongs....(pass)

com.android.music.tests.stress.MusicPlaybackStress#testActivityTestCaseSetUpProperly....(pass)

com.android.music.tests.functional.TestPlaylist#testDeletePlaylist....(pass)

com.android.music.tests.functional.TestPlaylist#testRenamePlaylist....(pass)

com.android.music.tests.functional.TestPlaylist#testActivityTestCaseSetUpProperly....(pass)

com.android.music.tests.functional.TestSongs#testAddPlaylist.....(pass)

com.android.music.tests.functional.TestSongs#testSetRingtone.....(pass)

com.android.music.tests.functional.TestSongs#testDeleteSong.....(pass)

com.android.music.tests.functional.TestSongs#testActivityTestCaseSetUpProperly....(pass)

com.android.music.tests.MusicPlayerStability#testPlay30sMP3....(pass)

com.android.music.tests.MusicPlayerStability#testLaunchMusicPlayer....(pass)

Testsummary:

pass=13fail=0timeOut=0notExecuted=0Total=13

Time:

100.780s

4.2遇到问题时方便调试的方法

$adbinstallout/target/product/xxxx/data/app/SginatureTest.apk安装某个用例包

$adbshellpmlistinstrumentationpm用于管理package,看当前机器安装了什么用例

$adbshellaminstrument-wandroid.tests.sigtest/.InstrumentationRunneram用于管理activity运行某一用例

$adbshellaminstrument-eclassandroid.app.cts.AlertDialogTest#testAlertDialog-wcom.android.cts.app/android.test/InstrumentationCtsTestRunner单独运行一个小case

如果在一个时间很长的plan(如Android)中,某处错了,而错误信息又不全,需要单独跑一个小case,用-e指明class明就可以节约很多时间

五、CTS介绍

1.单个运行CTS测试用例

1)安装

~/mydroid/out/host/linux-x86/cts/android-cts/repository/testcases$adbinstallCtsPerformanceTestCases.apk

70KB/s(4518bytesin0.062s)

pkg:

/data/local/tmp/CtsPerformanceTestCases.apk

Success

查看一下已经安装的instrumentation

~/mydroid/out/host/linux-x86/cts/android-cts/repository/testcases$adbshellpmlistinstrumentation

instrumentation:

com.android.cts.performance/android.test.InstrumentationTestRunner(target=com.android.calculator2)

com.android.example.spinner.test/android.test.InstrumentationTestRunner(target=com.android.example.spinner)

com.example.android.apis/.app.LocalSampleInstrumentation(target=com.example.android.apis)

com.example.helloandroid.test/android.test.InstrumentationTestRunner(target=com.example.helloandroid)

2)运行(失败)

:

~/mydroid/out/host/linux-x86/cts/android-cts/repository/testcases$adbshellaminstrument-w-rcom.android.cts.performance/android.test.InstrumentationTestRunner

INSTRUMENTATION_STATUS:

id=InstrumentationTestRunner

current=1

class=android.performance.cts.MultiAppStartupTest

stream=

android.performance.cts.MultiAppStartupTest:

numtests=1

test=testMultipleApps

INSTRUMENTATION_STATUS_CODE:

1

ErrorintestMultipleApps:

android.content.ActivityNotFoundException:

Unabletofindexplicitactivityclass{com.android.calendar/com.android.calendar.LaunchActivity};

haveyoudeclaredthisactivityinyourAndroidManifest.xml?

atandroid.app.Instrumentation.checkStartActivityResult(Instrumentation.java:

1404)

atandroid.app.Instrumentation.execStartActivity(Instrumentation.java:

1378)

atandroid.app.ApplicationContext.startActivity(ApplicationContext.java:

555)

atandroid.performance.cts.MultiAppStartupTest.launchActivity(MultiAppStartupTest.java:

52)

atandroid.performance.cts.MultiAppStartupTest.testMultipleApps(MultiAppStartupTest.java:

89)

atjava.lang.reflect.Method.invokeNative(NativeMethod)

atandroid.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:

205)

atandroid.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:

195)

atandroid.test.AndroidTestRunner.runTest(AndroidTestRunner.java:

169)

154)

atandroid.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:

430)

atandroid.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:

1447)

stack=android.content.ActivityNotFoundException:

atandroid.t

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 人文社科 > 法律资料

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2