边运行junit,边调试,蛋疼

这段时间无聊。开始用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

  1. 启动instrument,而且加上-e debug true。(也就是上面的脚本)。
  2. 打断点。估计用终端下打断点和eclipse里面打断点都行。不过我是在终端下打的。
  3. 这时候instrument就本身会跑了,遇到断点的地方就会停下来。
相关文章
相关标签/搜索