1page.title=Compatibility Test Suite 2@jd:body 3 4<!-- 5 Copyright 2014 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18--> 19 20<h2 id="how-does-the-cts-work">How does the CTS work?</h2> 21 22<div class="figure" style="width:383px"> 23 <img src="{@docRoot}images/cts-0.png" alt="CTS flow" height="340px" id="figure1" /> 24 <p class="img-caption"> 25 <strong>Figure 1.</strong> How to use CTS 26 </p> 27</div> 28 29<p>The CTS is an automated testing harness that includes two major software components:</p> 30<ul> 31<li> 32<p>The CTS test harness runs on your desktop machine and manages test execution.</p> 33</li> 34<li> 35<p>Individual test cases are executed on attached mobile devices or on an 36emulator. The test cases are written in Java as JUnit tests and packaged as 37Android .apk files to run on the actual device target.</p> 38</li> 39</ul> 40<h2 id="workflow">Workflow</h2> 41<p>This section summarizes CTS setup. Please refer to the <a href="android-cts-manual.pdf"> 42CTS User Manual</a> for detailed instructions.</p> 43<ol> 44<li> 45<p><a href="downloads.html">Download</a> the CTS and CTS media files.</p> 46</li> 47<li> 48<p>Attach at least one device (or emulator) to your machine.</p> 49</li> 50<li> 51<p>For CTS versions 2.1 R2 through 4.2 R4, set up your device (or emulator) to run the accessibility tests:</p> 52<ol> 53<li> 54<code>adb install -r android-cts/repository/testcases/CtsDelegatingAccessibilityService.apk</code> 55</li> 56<li> 57<p>On the device, enable Settings > Accessibility > Accessibility > Delegating Accessibility Service</p> 58</li> 59</ol> 60</li> 61<li> 62<p>For CTS 2.3 R4 and beyond, set up your device to run the device administration tests:</p> 63<ol> 64<li> 65<code>adb install -r android-cts/repository/testcases/CtsDeviceAdmin.apk</code> 66</li> 67<li> 68<p>On the device, enable the two <code>android.deviceadmin.cts.CtsDeviceAdminReceiver*</code> device 69administrators under Settings > Location & security > Select device administrators</p> 70<p><strong>Note</strong>: Make sure the <code>android.deviceadmin.cts.CtsDeviceAdminDeactivatedReceiver</code> 71stays disabled in the same menu.</p> 72</li> 73</ol> 74</li> 75<li> 76<p>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:</p> 77<ol> 78<li> 79<p>Unzip the CTS Media zip file.</p> 80</li> 81<li> 82<p>Run the following command. If no resolution is specified, the default maximum resolution of 83480x360 is assumed:</p> 84<code>copy_media.sh [720x480|1280x720|1920x1080|all] [-s serial]</code> 85</li> 86</ol> 87</li> 88<li> 89<p>Launch the CTS. The CTS test harness loads the test plan onto the attached devices. For each test in the test harness:</p> 90<ul> 91<li> 92<p>The test harness pushes an .apk file to each device, executes the test through instrumentation, and records test results.</p> 93</li> 94<li> 95<p>The test harness removes the .apk file from each device.</p> 96</li> 97</ul> 98</li> 99<li> 100<p>Once all the tests are executed, view the test results in your browser and 101use them to adjust your design. You can continue to run the CTS throughout your development process.</p> 102</li> 103</ol> 104<h2 id="types-of-test-cases">Types of test cases</h2> 105<p>The CTS includes the following types of test cases:</p> 106<ul> 107<li> 108<p><em>Unit tests</em> test atomic units of code within the Android platform; e.g. a single class, such as java.util.HashMap.</p> 109</li> 110<li> 111<p><em>Functional tests</em> test a combination of APIs together in a higher-level use-case.</p> 112</li> 113<li> 114<p><em>Reference application tests</em> instrument a complete sample application 115to exercise a full set of APIs and Android runtime services.</p> 116</li> 117</ul> 118<p>Future versions of the CTS will include the following types of test cases:</p> 119<ul> 120<li> 121<p><em>Robustness tests</em> test the durability of the system under stress.</p> 122</li> 123<li> 124<p><em>Performance tests</em> test the performance of the system against defined benchmarks, for example rendering frames per second.</p> 125</li> 126</ul> 127<h2 id="areas-covered">Areas Covered</h2> 128<p>The unit test cases cover the following areas to ensure compatibility:</p> 129<table> 130<thead> 131<tr> 132<th>Area</th> 133<th>Description</th> 134</tr> 135</thead> 136<tbody> 137<tr> 138<td>Signature tests</td> 139<td>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.</td> 140</tr> 141<tr> 142<td>Platform API Tests</td> 143<td>Test the platform (core libraries and Android Application Framework) APIs as documented in the SDK <a href="https://developer.android.com/reference/classes.html">Class Index</a> 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.</td> 144</tr> 145<tr> 146<td>Dalvik VM Tests</td> 147<td>The tests focus on testing the Dalvik Executable Format.</td> 148</tr> 149<tr> 150<td>Platform Data Model</td> 151<td>The CTS tests the core platform data model as exposed to application developers through content providers, as documented in the SDK <a href="https://developer.android.com/reference/android/provider/package-summary.html">android.provider</a> package: contacts, browser, settings, etc.</td> 152</tr> 153<tr> 154<td>Platform Intents</td> 155<td>The CTS tests the core platform intents, as documented in the SDK <a href="https://developer.android.com/guide/appendix/g-app-intents.html">Available Intents</a>.</td> 156</tr> 157<tr> 158<td>Platform Permissions</td> 159<td>The CTS tests the core platform permissions, as documented in the SDK <a href="https://developer.android.com/reference/android/Manifest.permission.html">Available Permissions</a>.</td> 160</tr> 161<tr> 162<td>Platform Resources</td> 163<td>The CTS tests for correct handling of the core platform resource types, as documented in the SDK <a href="https://developer.android.com/guide/topics/resources/available-resources.html">Available Resource Types</a>. This includes tests for: simple values, drawables, nine-patch, animations, layouts, styles and themes, and loading alternate resources.</td> 164</tr> 165</tbody> 166</table> 167