Android开发中的单元测试
1、测试类一定要extendsAndroidTestCase 类 2、测试方法要以test开头,并抛出异常 3、在测试方法中new出要测试的类,然后对应其功能进行测试 (经常会用到Assert.assertEquals(a,b);) package com.zhy.junitExample.test; import com.zhy.servers.server; import android.test.AndroidTestCase; public class serverTest extends AndroidTestCase { public void testsave() throws Exception{ server ser = new server(); ser.save(); } } 4、在AndroidMainfest中要添加 <uses-library android:name="android.test.runner" /> 加入测试库 <instrumentation android:name="android.test.Instrumentat...



