对应若水老师的第十四课
一,Log日志输出
Log.v(tag,message); //verbose模式,打印最详细的日志<!-- <application> 中:-->
<uses-library android:name="android.test.runner"/>
<!-- </application> 之后: -->
<instrumentation
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="szy.android.activity" android:label="Testing/>
<!--注意!!android:targetPackage中要与项目名字一样才能运行成功!--> step2写单元测试代码public class PersonDAOTest extends AndroidTestCase {
private static final String TAG = "PersonDAOTest";
public void testAdd() //要测试的方法
{
Log.i(TAG,"Test");
}
public void testDelete() //要测试的方法
{
fail("Not yet implemented");
}
}测试时选中测试的类中的某个方法右键RunAS->android junit testdebug比较简单,自己上手摸索.
附:
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/sac761/article/details/47401825