android单元测试

1.需要测试的类继承AndroidTestCase接口

在类中需要测试的方法的方法名必须以test开头

2.在manifast配置文件的application标签中添加

<uses-library android:name="android.test.runner"/>

在application标签外添加

<instrumentation

android:name="android.test.InstrumentationTestRunner"

android:targetPackage="com.example.anjoyo0727_pullparsertest" 
android:label="Test for my app"/>

3.Run as->Android JUnit Test运行程序

原文地址:https://www.cnblogs.com/dcxz/p/3340373.html