How to add a test plan, package to Android CTS? --Erin Yueh
上一篇 / 下一篇 2011-12-07 09:34:26 / 个人分类:转
TAG:
- 引用 删除 haldis / 2011-12-07 10:01:46
-
How to add test plan, test packages to CTS?
Add test package name to cts.mk, it would generate apk file when we build cts.
Add all source folder (includes src java files, Android.mk and its Manifest file) to mydroid/cts/tests/tests
If you'd like to create a test plan for this test package. Modify this python script: mydroid/cts/tools/utils/buildCts.py
Adjust CTS program settings?
Modify $mydroid/cts/tools/utils/host_config.xml
Number of tests executed between reboots. A value <= 0 disables reboots. (maxTestCount)
Max size [tests] for a package to be run in batch mode. (maxTestInBatchMode)
Max time [ms] between test status updates. (testStatusTimeoutMs)
Max time [ms] from start of package in batch mode and the first test status update. (batchStartTimeoutMs)
Max time [ms] from start of test in individual mode to the first test status update. (individualStartTimeoutMs)
Timeout [ms] for the signature check. (signatureTestTimeoutMs)
Timeout [ms] for package installations. (packageInstallTimeoutMs)
Time to wait [ms] after a package installation or removal. (postInstallWaitMs)
Write your own testing package?
If you would like to write your own testing package, you may reference the Instrumentation Testing document from Android porting guide. Also, you could reference the source code from few Android application, like Browser, Messages, Gallery, Email, Camera, Calculator....etc. You can build its test apk file and upload it to device.
How to write test cases?
Each instrumentation test case is similar to an Android application with the distinction that it starts another application. For example, have a look in the $MYDROID/packages/apps/Music directory.
There should be a Makefile and an Android Manifest file
Tests are located in $MYDROID/packages/apps/Music/tests.
The Instrumentation Test Runner is located at packages/apps/Music/tests/src/com/android/music/MusicPlayerFunctionalTestRunner.java.
Build package apk file
erin@midnight:~/eclair/mydroid/packages/apps/Music/tests$ mm
Install: out/target/product/generic/data/app/MusicTests.apk
Install it to the device
erin@midnight:~/eclair/mydroid/packages/apps/Music/tests$ adb install ../../../../out/target/product/generic/data/app/MusicTests.apk
How to run test cases in device?
Running Tests
erin@midnight:~/$ adb shell pm list instrumentation
instrumentation:com.android.music.tests/.MusicPlayerStressTestRunner (target=com.android.music)
instrumentation:com.android.music.tests/.MusicPlayerFunctionalTestRunner (target=com.android.music)
instrumentation:com.android.music.tests/.MusicPlayerLaunchPerformance (target=com.android.music)
The am command is a command-line interface to the ActivityManager. 'am' is used to start and instrument activities using the adb shell command, as shown in the snippet below:
> adb shell amusage: am [start|instrument] am start [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>] [-c <CATEGORY> [-c <CATEGORY>] ...] [-e <EXTRA_KEY> <EXTRA_VALUE> [-e <EXTRA_KEY> <EXTRA_VALUE> ...] [-n <COMPONENT>] [-D] [<URI>] am instrument [-e <ARG_NAME> <ARG_VALUE>] [-p <ROF_FILE>] [-w] <COMPONENT> For example, to start the Contacts application you can use> adb shell am start -n com.google.android.contacts/.ContactsActivity
Eg. verify Music player launcher performance
erin@midnight:~/$ adb shell am instrument -w -r com.android.music.tests/.MusicPlayerLaunchPerformance
Eg. verify Music player stress test
erin@midnight:~/$ adb shell am instrument -w -r com.android.music.tests/.MusicPlayerStressTestRunner
Here is a video about running a cts test case by Android emulator!
标题搜索
日历
|
|||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
1 | 2 | 3 | 4 | ||||||
5 | 6 | 7 | 8 | 9 | 10 | 11 | |||
12 | 13 | 14 | 15 | 16 | 17 | 18 | |||
19 | 20 | 21 | 22 | 23 | 24 | 25 | |||
26 | 27 | 28 | 29 | 30 | 31 |
我的存档
数据统计
- 访问量: 134663
- 日志数: 44
- 图片数: 1
- 文件数: 1
- 建立时间: 2010-12-03
- 更新时间: 2014-08-05