在AndroidManifest.xml中
在<application>中添加
<uses-library android:name="android.test.runner"/><!-- 单元测试 -->
在<manifest>中添加
<instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="cn.edu.database" android:label="Tests my app"></instrumentation>
编写测试类,该类继承AndroidTestCase
public class MyTest extends AndroidTestCase {
public void testSava() throws Exception
{
new ProductService(this.getContext()).save();
}
}