这段时间无聊。开始用TDD模式开发android app。嘿,发现还真爽。一成天不碰device,一直就看着屏幕上出现“OK”或者“Fail"的感受还不错。android
因为本人是IDE去死团团员, 因此运行junit的方式就变成了shell
adb shell am instrument -w com.android.contacts.tests/android.test.InstrumentationTestRunner
运行上面的脚本以后,junit就开始跑了。不过在这之中打断点的话,dvm是不理你的。
因此我又蛋疼了,蛋疼了就去google了一下,发如今运行instrument的时候还能够加上debug true的option。以下:app
adb shell am instrument -w -e debug true true com.android.contacts.tests/android.test.InstrumentationTestRunner
不过加上以后一运行,发现什么反应都没有,junit也不跑了。断点也没有进入。后来折腾了半天,才找到解决办法。
过程以下:eclipse