一、修改AndroidManifest.xml配置文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thinker.sqlitedemo"
android:versionCode="1"
android:versionName="1.0" >
<span style="color:#ff0000;"><instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.thinker.sqlitedemo"></instrumentation></span>
<!--<pre name="code" class="html"><span style="color:#ff0000;">android:targetPackage 是你的包名</span>
--> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" ><uses-library android:name="android.test.runner"/> <activity android:name=".MainActivity" 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></manifest>
</pre><p></p><pre>
添加上面红色字体的内容
二、创建TestCase测试类,要继承AndroidTestCase
package com.thinker.sqlitedemo.test;
import com.thinker.sqlitedemo.db.SQLiteOPenHelper;
import android.test.AndroidTestCase;
public class TestCase extends AndroidTestCase {
public void test(){
//
SQLiteOPenHelper oPenHelper = new SQLiteOPenHelper(this.getContext());
}
}