Test of Androidtestcase

Source: Internet
Author: User
<span id="Label3"></p><p><p>The easiest thing to think about is junit, which is written in android, especially with HTTP. Do not want ordinary Java program only need to add annotation on the method above @test,android need to be configured in the manifest file, also need to define a test class.</p></p><p><p></p></p><p><p>Steps:</p></p><p><p>1. Writing test Classes (inheriting Androidtestcase)</p></p><p><p>2. Configure in manifest.xml, add <uses-library android:name= "android.test.runner"/> under the application node; Add to Application Sibling directory</p></p><p><p><instrumentation<br>Android:name= "android.test.InstrumentationTestRunner"<br>Android:label= "test"<br>Android:targetpackage= "com.example.testaudio"/></p></p><p><p>3. Run the application yes, select Run as Junit</p></p><p><p></p></p><p><p>Configuration for Example:</p></p><p><p> <manifest xmlns:android= "http://schemas.android.com/apk/res/android"    <br>     package= "com.example.testaudio"    <br>     android:versioncode= "1"    <br>      android:versionname= "1.0" >   <br>    <br>     <uses-sdk    <br>         android:minsdkversion= "8"    <br>          android:targetsdkversion= "/>  "; <br>    <br>      <application   <br>         android:allowbackup= "true" &NBSP;&NBSP <br>         android:icon= "@drawable/ic_launcher"    <br>         android:label= "@string/app_name"    <br>          android:theme= "@style/apptheme" >   </p></p><p><p><br><span style="color: #ff0000;"><uses-library android:name= "android.test.runner"/></span></p></p><p><p><br></application></p></p><p><p><br><!--to the same location as the application label<br><span style="color: #ff0000;"><instrumentation</span><br><span style="color: #ff0000;">Android:name= "android.test.InstrumentationTestRunner"</span><br><span style="color: #ff0000;">Android:label= "test"</span><br><span style="color: #ff0000;">android:targetpackage= "com.example.testaudio"/></span><br><br></manifest></p></p><p><p></p></p><p><p>  </p></p><p><p>Test of Androidtestcase</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.