junit单元测试
首先你需要在清单文件中加上如下:
<instrumentation
android:name="android.test.InstrumentationTestRunner"
//指定该测试框架要测试哪一个项目
android:targetPackage="com.itheima.junit"
></instrumentation>
这段是与<application>同级,然后在<application>中加上如下:
<uses-library android:name="android.test.runner"/>
这是为了定义使用的类库
然后再定义如下测试类,继承AndroidTestCase
public class Test extends AndroidTestCase{ public void test(){ System.out.println("测试"); } }