1page.title=Testing Your Android Activity 2page.tags=testing 3 4trainingnavtop=true 5startpage=true 6 7@jd:body 8 9<div id="tb-wrapper"> 10<div id="tb"> 11 12<!-- Required platform, tools, add-ons, devices, knowledge, etc. --> 13<h2>Dependencies and prerequisites</h2> 14<ul> 15 <li>Android 2.2 (API Level 8) or higher.</li> 16</ul> 17 18<h2>You Should Also Read</h2> 19<ul> 20<li><a href="{@docRoot}tools/testing/index.html">Testing 21(Developer's Guide)</a></li> 22</ul> 23 24</div> 25</div> 26 27<p>You should be writing and running tests as part of your Android application 28development cycle. Well-written tests can help you to catch bugs early in 29development and give you confidence in your code.</p> 30 31<p>A <em>test case</em> defines a set of objects and methods to run multiple 32tests independently from each other. Test cases can be organized into 33<em>test suites</em> and run programmatically, in a repeatable manner, with 34a <em>test runner</em> provided by a testing framework.</p> 35 36<p>The lessons in this class teaches you how to use the Android's custom 37testing framework that is based on the popular JUnit framework. You can 38write test cases to verify specific behavior in your application, and check for 39consistency across different Android devices. Your test cases also serve as a 40form of internal code documentation by describing the expected behavior of 41app components.</p> 42 43<h2>Lessons</h2> 44 45<!-- Create a list of the lessons in this class along with a short description 46of each lesson. These should be short and to the point. It should be clear from 47reading the summary whether someone will want to jump to a lesson or not.--> 48 49<dl> 50 <dt><b><a href="preparing-activity-testing.html">Setting Up Your Test 51Environment</a></b></dt> 52 <dd>Learn how to create your test project.</dd> 53 <dt><b><a href="activity-basic-testing.html">Creating and Running a Test 54Case</a></b></dt> 55 <dd>Learn how to write test cases to verify the 56expected properties of your {@link android.app.Activity}, and run the test 57cases with the {@code Instrumentation} test runner provided by the Android 58framework.</dd> 59 <dt><b><a href="activity-ui-testing.html">Testing UI Components</a></b></dt> 60 <dd>Learn how to test the behavior of specific UI 61components in your {@link android.app.Activity}.</dd> 62 <dt><b><a href="activity-unit-testing.html">Creating Unit Tests</a></b></dt> 63 <dd>Learn how to how to perform unit testing to 64verify the behavior of an Activity in isolation.</dd> 65 <dt><b><a href="activity-functional-testing.html">Creating Functional Tests</a></b></dt> 66 <dd>Learn how to perform functional testing to 67verify the interaction of multiple Activities.</dd> 68 69