<
uses-library
android:name
="android.test.runner"
/>
<
instrumentation
android:name
="android.test.InstrumentationTestRunner"
android:targetPackage
="com.juniux.junittest"
android:label
="Test My App"
/>
<!--
android:label屬性可忽略
-->
package com.juniux.test;
import junit.framework.Assert;
import com.juniux.services.PersonService;
import android.test.AndroidTestCase;
public
class PersonServiceTest
extends AndroidTestCase {
public
void TestSave()
throws Exception {
PersonService service =
new PersonService();
service.Save(
null);
}
public
void TestAdd()
throws Exception
{
PersonService service =
new PersonService();
int result = service.Add(1, 2);
Assert.assertEquals(3, result);
}
}