Android实例系列---03.Android中的Junit单元测试
1.AndroidManifest.xml配置
application内
<uses-library android:name="android.test.runner" />
application外
<instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="cn.netcenter.test" android:label="Tests for My App" />
2.测试方法命名以test开头如:testSave()
private static final String TAG = "PersonServiceTest"; public void testSave() throws Throwable{ PersonService service = new PersonService(); int b = service.save();//检验save()方法运行是否正常 //Log.i(TAG, "result="+ b); //System.out.println(); //System.err.println("result="+ b); Assert.assertEquals(78, b); }
相关推荐
bobljm 2020-07-07
84224552 2020-05-31
snowphy 2020-05-30
JackYin 2020-01-24
80487608 2014-07-04
84224552 2019-12-01
84224552 2019-11-12
lsmalltiger 2017-05-16
snowphy 2011-02-22
蛰脚踝的天蝎 2010-08-27
不忘初心才能始终 2019-07-01
89510091 2014-07-04
HuoBaoYan 2011-12-16
不忘初心才能始终 2019-06-27
HuoBaoYan 2011-08-11
80487608 2011-05-16
HuoBaoYan 2011-04-05