比如对于一个acticity,其中有一个方法a();我该怎么用junit框架对其进行测试呢?
我是用爱内测http://t.cn/R2gpSpW 做检测的耶。。。因为我觉得还是挺方便快捷的
建一个Java类继承TestCase类,把要测试的方法放进来,方法上加上注解,(如@UiThreadTest)具体哪个注解查下,然后在清单文件配置,
android:targetPackage="com.example.android.apis"
android:label="Tests for Api Demos."/>
然后右键测试方法,使用测试运行,运行前添加junit运行类库
<instrumentation android:name="android.test.InstrumentationTestRunner"
配置代码