blob: f489fc63cccac67e3518f19ac9981cf467640f3a [file] [log] [blame]
Robert Ly35f2fda2013-01-29 16:27:05 -08001page.title=Compatibility Test Suite
2@jd:body
3
4<!--
Clay Murphye4edda62014-10-16 19:00:15 -07005 Copyright 2014 The Android Open Source Project
Robert Ly35f2fda2013-01-29 16:27:05 -08006
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<div style="float: right">
Clay Murphya69844e2013-05-30 17:56:38 -070022 <img src="{@docRoot}images/cts-0.png">
Robert Ly35f2fda2013-01-29 16:27:05 -080023</div>
24
25<p>The CTS is an automated testing harness that includes two major software components:</p>
26<ul>
27<li>
28<p>The CTS test harness runs on your desktop machine and manages test execution.</p>
29</li>
30<li>
31<p>Individual test cases are executed on attached mobile devices or on an
32emulator. The test cases are written in Java as JUnit tests and packaged as
33Android .apk files to run on the actual device target.</p>
34</li>
35</ul>
36<h2 id="workflow">Workflow</h2>
Clay Murphy9e4e2192013-12-02 14:40:16 -080037<p>This section summarizes CTS setup. Please refer to the <a href="android-cts-manual.pdf">
38CTS User Manual</a> for detailed instructions.</p>
Robert Ly35f2fda2013-01-29 16:27:05 -080039<ol>
40<li>
41<p><a href="downloads.html">Download</a> the CTS and CTS media files.</p>
42</li>
43<li>
44<p>Attach at least one device (or emulator) to your machine.</p>
45</li>
46<li>
Clay Murphyea9a7962013-10-08 16:56:55 -070047<p>For CTS versions 2.1 R2 through 4.2 R4, set up your device (or emulator) to run the accessibility tests:</p>
Robert Ly35f2fda2013-01-29 16:27:05 -080048<ol>
49<li>
Clay Murphyc9211b12013-12-11 14:01:55 -080050<code>adb install -r android-cts/repository/testcases/CtsDelegatingAccessibilityService.apk</code>
Robert Ly35f2fda2013-01-29 16:27:05 -080051</li>
52<li>
53<p>On the device, enable Settings &gt; Accessibility &gt; Accessibility &gt; Delegating Accessibility Service</p>
54</li>
55</ol>
56</li>
57<li>
Clay Murphy0a920542013-09-13 13:39:33 -070058<p>For CTS 2.3 R4 and beyond, set up your device to run the device administration tests:</p>
Robert Ly35f2fda2013-01-29 16:27:05 -080059<ol>
60<li>
Clay Murphyc9211b12013-12-11 14:01:55 -080061<code>adb install -r android-cts/repository/testcases/CtsDeviceAdmin.apk</code>
Robert Ly35f2fda2013-01-29 16:27:05 -080062</li>
63<li>
Clay Murphyc9211b12013-12-11 14:01:55 -080064<p>On the device, enable the two <code>android.deviceadmin.cts.CtsDeviceAdminReceiver*</code> device
65administrators under Settings &gt; Location &amp; security &gt; Select device administrators</p>
66<p><strong>Note</strong>: Make sure the <code>android.deviceadmin.cts.CtsDeviceAdminDeactivatedReceiver</code>
Clay Murphy376cfcb2013-12-11 11:19:42 -080067stays disabled in the same menu.</p>
Robert Ly35f2fda2013-01-29 16:27:05 -080068</li>
69</ol>
70</li>
71<li>
72<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>
73<ol>
74<li>
75<p>Unzip the CTS Media zip file.</p>
76</li>
77<li>
Clay Murphyc9211b12013-12-11 14:01:55 -080078<p>Run the following command. If no resolution is specified, the default maximum resolution of
79480x360 is assumed:</p>
80<code>copy_media.sh [720x480|1280x720|1920x1080|all] [-s serial]</code>
Robert Ly35f2fda2013-01-29 16:27:05 -080081</li>
82</ol>
83</li>
84<li>
85<p>Launch the CTS. The CTS test harness loads the test plan onto the attached devices. For each test in the test harness:</p>
86<ul>
87<li>
Clay Murphy710b6652014-01-06 16:04:37 -080088<p>The test harness pushes an .apk file to each device, executes the test through instrumentation, and records test results.</p>
Robert Ly35f2fda2013-01-29 16:27:05 -080089</li>
90<li>
91<p>The test harness removes the .apk file from each device.</p>
92</li>
93</ul>
94</li>
95<li>
Clay Murphy710b6652014-01-06 16:04:37 -080096<p>Once all the tests are executed, view the test results in your browser and
97use them to adjust your design. You can continue to run the CTS throughout your development process.</p>
Robert Ly35f2fda2013-01-29 16:27:05 -080098</li>
99</ol>
Robert Ly35f2fda2013-01-29 16:27:05 -0800100<h2 id="types-of-test-cases">Types of test cases</h2>
101<p>The CTS includes the following types of test cases:</p>
102<ul>
103<li>
104<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>
105</li>
106<li>
107<p><em>Functional tests</em> test a combination of APIs together in a higher-level use-case.</p>
108</li>
109<li>
Clay Murphy710b6652014-01-06 16:04:37 -0800110<p><em>Reference application tests</em> instrument a complete sample application
111to exercise a full set of APIs and Android runtime services.</p>
Robert Ly35f2fda2013-01-29 16:27:05 -0800112</li>
113</ul>
114<p>Future versions of the CTS will include the following types of test cases:</p>
115<ul>
116<li>
117<p><em>Robustness tests</em> test the durability of the system under stress.</p>
118</li>
119<li>
120<p><em>Performance tests</em> test the performance of the system against defined benchmarks, for example rendering frames per second.</p>
121</li>
122</ul>
123<h2 id="areas-covered">Areas Covered</h2>
124<p>The unit test cases cover the following areas to ensure compatibility:</p>
125<table>
126<thead>
127<tr>
128<th>Area</th>
129<th>Description</th>
130</tr>
131</thead>
132<tbody>
133<tr>
134<td>Signature tests</td>
135<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>
136</tr>
137<tr>
138<td>Platform API Tests</td>
139<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>
140</tr>
141<tr>
142<td>Dalvik VM Tests</td>
Clay Murphye4edda62014-10-16 19:00:15 -0700143<td>The tests focus on testing the Dalvik Executable Format.</td>
Robert Ly35f2fda2013-01-29 16:27:05 -0800144</tr>
145<tr>
146<td>Platform Data Model</td>
147<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>
148</tr>
149<tr>
150<td>Platform Intents</td>
151<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>
152</tr>
153<tr>
154<td>Platform Permissions</td>
155<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>
156</tr>
157<tr>
158<td>Platform Resources</td>
159<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>
160</tr>
161</tbody>
162</table>