这是我的项目清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="cn.db"
    android:versionCode="1"
    android:versionName="1.0" >    <uses-sdk android:minSdkVersion="8" />    <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" >        <provider android:name=".personProvider" android:authorities="cn.db.providers.first"/>
        <uses-library android:name="android.test.runner"/>
        
        <activity
            android:label="@string/app_name"
            android:name=".DbActivity" >
             
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
    android:targetPackage="cn.db" android:label="My test"/>
</manifest>这是实现contentProvider的类package cn.db;import cn.db.service.DBHelper;
import cn.db.service.PersonService;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;public class personProvider extends ContentProvider {
private DBHelper ps;
private static final UriMatcher macher=new UriMatcher(UriMatcher.NO_MATCH);
private static final int PERSONS=1;
static{
macher.addURI("cn.db.providers.first", "person", PERSONS);
}
@Override
public int delete(Uri arg0, String arg1, String[] arg2) {
// TODO Auto-generated method stub
return 0;
} @Override
public String getType(Uri uri) {
// TODO Auto-generated method stub
return null;
} @Override
public Uri insert(Uri uri, ContentValues values) {
// TODO Auto-generated method stub
SQLiteDatabase db=ps.getWritableDatabase();
switch(macher.match(uri)){
case 1:
long rowid= db.insert("person", "name", values);
Uri result=ContentUris.withAppendedId(uri, rowid);
return result;
default:
throw new IllegalArgumentException("this is unknow uri"+uri);

}
} @Override
public boolean onCreate() {
// TODO Auto-generated method stub
ps=new DBHelper(getContext());
return true;
} @Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
// TODO Auto-generated method stub
return null;
} @Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
// TODO Auto-generated method stub
return 0;
}}
以上运行的时候都没有错 但是在运行测试类的时候就报错:Test run failed: Test run failed to complete. Expected 1 tests, received 0
测试类如下package cn.othertest;import android.content.ContentResolver;
import android.content.ContentValues;
import android.net.Uri;
import android.test.AndroidTestCase;public class personProviderTest extends AndroidTestCase {


public personProviderTest() {
super();
// TODO Auto-generated constructor stub
} private void TestpsersonProviderInster()throws Exception{
Uri uri=Uri.parse("content://cn.db.providers.first/person");

}
}
有警告说:The local variable uri is never read 跪求指点!!