<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.jgw.hello"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.jgw.hello" android:label="test my app"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".HellowordActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="android.test.runner"/><!-- 引用单元测试所需要的类库 -->
</application>
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.jgw.hello"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.jgw.hello" android:label="test my app"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".HellowordActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="android.test.runner"/><!-- 引用单元测试所需要的类库 -->
</application>
</manifest>
1、配置文件如上
2、单元测试类创建
package org.jgw.test;
import junit.framework.Assert;
import org.jgw.service.PersonService;
import android.test.AndroidTestCase;
public class testPerson extends AndroidTestCase {
public void testSave() throws Exception
{
PersonService p=new PersonService();
p.Save(null);
}
public void testAdd() throws Exception
{
PersonService p=new PersonService();
int rtn=p.Add(1, 2);
Assert.assertEquals(4, rtn);
}
}
3、输出信息
Log.i("mxh","www.csdn.net");
Log.e("mxh","www.csdn.net");
Log.d("mxh","www.csdn.net");
Log.v("mxh","www.csdn.net");
Log.d("mxh","www.csdn.net");
Log.v("mxh","www.csdn.net");