第一步:
Manifest.xml中
<application>中加入:
[b]<uses-library android:name="android.test.runner" />[/b]
<application>外面加入:
<uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
<instrumentation
android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.scofield.activity"
android:label="Test for my app"/>
第2步
编写单元测试代码:必须继承自AndroidTestCase类
import android.test.AndroidTestCase;
import junit.framework.Assert;
public class TestLogin extends AndroidTestCase {
private static final String Tag="TestLogin ";
public void login() throws Throwable
{
}
}
Manifest.xml中
<application>中加入:
[b]<uses-library android:name="android.test.runner" />[/b]
<application>外面加入:
<uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
<instrumentation
android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.scofield.activity"
android:label="Test for my app"/>
第2步
编写单元测试代码:必须继承自AndroidTestCase类
import android.test.AndroidTestCase;
import junit.framework.Assert;
public class TestLogin extends AndroidTestCase {
private static final String Tag="TestLogin ";
public void login() throws Throwable
{
}
}