The CTS is an automated testing harness that includes two major software components:
The CTS test harness runs on your desktop machine and manages test execution.
Individual test cases are executed on attached mobile devices or on an emulator. The test cases are written in Java as JUnit tests and packaged as Android .apk files to run on the actual device target.
Download the CTS and CTS media files.
Attach at least one device (or emulator) to your machine.
For CTS 2.1 R2 and beyond, setup your device (or emulator) to run the accessibility tests:
adb install -r android-cts/repository/testcases/CtsDelegatingAccessibilityService.apk
On the device, enable Settings > Accessibility > Accessibility > Delegating Accessibility Service
For CTS 2.3 R4 and beyond, setup your device to run the device administration tests:
adb install -r android-cts/repository/testcases/CtsDeviceAdmin.apk
On the device, enable all the android.deviceadmin.cts.* device administrators under Settings > Location & security > Select device administrators
For CTS 2.3 R12 and beyond, the CTS media files must be copied to the device's external storage. Check section 4.2 of the latest CTS manual for further details on copying these files:
Unzip the CTS Media zip file.
Run copy_media.sh [720x480|1280x720|1920x1080|all] [-s serial]. If no resolution is specified, the default maximum resolution of 480x360 is assumed.
Launch the CTS. The CTS test harness loads the test plan onto the attached devices. For each test in the test harness:
The test harness pushes a .apk file to each device, executes the test through instrumentation, and records test results.
The test harness removes the .apk file from each device.
Once all the tests are executed, you can view the test results in your browser and use the results to adjust your design. You can continue to run the CTS throughout your development process.
When you are ready, you can submit the report generated by the CTS to [email protected]. The report is a .zip archived file that contains XML results and supplemental information such as screen captures.
The CTS includes the following types of test cases:
Unit tests test atomic units of code within the Android platform; e.g. a single class, such as java.util.HashMap.
Functional tests test a combination of APIs together in a higher-level use-case.
Reference application tests instrument a complete sample application to exercise a full set of APIs and Android runtime services
Future versions of the CTS will include the following types of test cases:
Robustness tests test the durability of the system under stress.
Performance tests test the performance of the system against defined benchmarks, for example rendering frames per second.
The unit test cases cover the following areas to ensure compatibility:
Area | Description |
---|---|
Signature tests | For each Android release, there are XML files describing the signatures of all public APIs contained in the release. The CTS contains a utility to check those API signatures against the APIs available on the device. The results from signature checking are recorded in the test result XML file. |
Platform API Tests | Test the platform (core libraries and Android Application Framework) APIs as documented in the SDK Class Index to ensure API correctness, including correct class, attribute and method signatures, correct method behavior, and negative tests to ensure expected behavior for incorrect parameter handling. |
Dalvik VM Tests | The tests focus on testing the Dalvik VM |
Platform Data Model | The CTS tests the core platform data model as exposed to application developers through content providers, as documented in the SDK android.provider package: contacts, browser, settings, etc. |
Platform Intents | The CTS tests the core platform intents, as documented in the SDK Available Intents. |
Platform Permissions | The CTS tests the core platform permissions, as documented in the SDK Available Permissions. |
Platform Resources | The CTS tests for correct handling of the core platform resource types, as documented in the SDK Available Resource Types. This includes tests for: simple values, drawables, nine-patch, animations, layouts, styles and themes, and loading alternate resources. |