First, why the need for compatibility Test (hereinafter referred to as CTS)?
1.1, let the app provide a better user experience. Users can choose from many other apps that suit their device. Make apps more stable.
1.2. Let developers design more high-quality apps.
1.3, through the CTS equipment can execute Android Market.
In addition, CTS is free and very easy.
Two. CTS is an open-source test framework that uses it to test if your device is compatible. The CTS mainly consists of two components:
Execute the test frame component on the PC. Primarily used to manage the execution of test cases.
Perform a sample test on a device or simulator. These use cases are written in Java apk file.
Third, the work flow
1, the ability to compile the CTS from the source code, but also to download the compiled CTS from the site
2. Install and configure CTS.
3. Connect the device to the PC.
4, the implementation of CTS. The CTS transmits the corresponding test example (that is, an apk file) to the device and executes it through instrumentation, then records the execution result and finally deletes the test example.
After all the test examples are completed, the test results can be adjusted or optimized again. Then proceed to the CTS test.
5. After testing, you will be able to submit the CTS generated results (that is, the result of the test time named after the. zip file) to [email protected].
IV. Immediate Test coverage
For now, to ensure compatibility, test cases cover these ranges
1, Signature
For each Android product, there are XML files describing all of the public APIs. The CTS includes a tool to detect whether the APIs included in these API signatures are supported in the system.
2, Platform
The platform API described in the Test SDK documentation, such as the core libraries,android application framework. These APIs are required to provide:
Correct class, attribute, method signature, method behavior, error parameter handling method
3. Dalvik VM
A test specifically for Dalvik VMs.
4. Platform Data Model
The platform provides data to developers using ContentProvider, such as contacts,browser,settings.
5, Platform Intents
The platform provides intent for core functionality.
6, Platform permission
Some important app permissions provided by the platform
7. Platform Resources
Simple Values,drawables,nine-patch,animations,layouts,styles and themes,loading alternate resources, etc.
V. Construction of CTS (Unbutu/linux platform)
1. Download CTS Package http://source.android.com/compatibility/downloads.html
2. Installing ctsdelegatingaccessibilityservice.apk on the phone or simulator is not required
(1) $sudo./ADB Install-r/home/tester/cts/android-cts/repository/testcases
/ctsdelegatingaccessibil
ityservice.apk
(2) Phone or simulator settings settings > Accessibility > Accessibility > Delegating accessibility Service
3. Go to the Android/out/host/linux-x86/cts/android-cts/repository/tools folder and change the startcts script file. Put the sdk_root in the script into its own Android SDK path.
$CD Home/tester/cts/android-cts/repository/tools $vim The first sdk_root that appears in the Startcts change script, such as "sdk_root=/home/tester/cts/ Android-sdk-linux_86 ".
4. Run the startcts script. When running the CTS Test plan (longer than 5 minutes after running for a period of time), there is insufficient permission to start devices, using $sudo./startcts to resolve the issue.
(after configuring the SDK and Android development environment under Windows, you can run the CTS test directly from the Java command: JAVA-XMX512M-CP d:\android-cts\tools\cts.jar;d:\android-cts\ Tools\hosttestlib.jar;d:\android-cts\tools\junit.jar; C:\Android\android-sdk\tools\lib\ddmlib.jar Com.android.cts.TestHost D:\android-cts\repository\host_config.xml
Suppose you use a ANDROID-CTS-2.2_R4-X86.ZIP,-CP option that requires one more D:\android-cts\tools\lib\ Ctstestannotationshostlib.jar, the Startcts script can be tested. )
5. The following prompt appears for example to start the CTS and connect the device successfully. (The red part is not DeviceID, depending on the device number)
Android CTS version 2.3_r4
Device (emulator-5544) connected
Cts_host > Cts_host >
6. Enter the command at the "Cts_host >" prompt, following a few frequently used commands
Help View All
Exit exits
Ls-p List of all test kits
LS--plan lists all the test plans
Start--plan Plan_name performs a test scheme, such as: Start--plan CTS
Start--plan plan_name--package Package_name performs a specific test package, such as: Start--plan CTS--package Android.bluetooth
Vi. Viewing test reports
When testing is performed, the test report and execution status can be seen in the CTS execution interface. After testing, you can generate a specific test report and some additional information under android-cts/repository/results/, and when the catalog is named with the date and time, all the test results, the same time the directory will be played into a corresponding. zip package for easy submission. Open the. xml file in a browser (by default, double-click) to see the test report used.
Seven: Web site
Http://hi.baidu.com/jugege/blog/item/dcb6edf3f88e8d43352accb0.html
Android self-initiated test--cts test