4.安卓(单元测试)

<?xml version="1.0" encoding="utf-8"?>  
<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
      package="hb.learn.junit"  
      android:versionCode="1"  
      android:versionName="1.0">  
    <uses-sdk android:minSdkVersion="8" />  
    <application android:icon="@drawable/icon" android:label="@string/app_name">  
      
        <!-- 在本应用中导入需要使用的包,放在application里面activity外面 -->  
        <uses-library android:name="android.test.runner" />  
          
        <activity android:name=".JunitTestActivity"  
                  android:label="@string/app_name">  
            <intent-filter>  
                <action android:name="android.intent.action.MAIN" />  
                <category android:name="android.intent.category.LAUNCHER" />  
            </intent-filter>  
        </activity>  
          
    </application>  
      
    <!-- 记住这个一要放在application外面,不然会出现配置错误 信息 -->  
    <instrumentation android:name="android.test.InstrumentationTestRunner"  
        android:targetPackage="hb.learn.junit" android:label="Tests for My App" />
hb.learn.junit 这个东西一定要和上面的一模一样才可以
</manifest>
  1. import android.test.AndroidTestCase;  
  2. import android.util.Log;  
  3. public class XMLTest extends AndroidTestCase {  
  4.      public void testSomething() throws Throwable {  
  5.         开始测试吧
  6.      }  
posted @ 2014-05-04 01:41  宝贝,我永远都在  阅读(103)  评论(0)    收藏  举报