是否有可能运行JUnit测试的时候进入调试模式为Android?有可能、时候、模式、测试

2023-09-06 04:03:03 作者:钟爱一生

我通常运行JUnit测试使用亚行外壳上午仪器-w com.android.contacts.tests / android.test.InstrumentationTestRunner 。而它的实际工作,它将运行所有的测试。

Usually i run a junit test using adb shell am instrument -w com.android.contacts.tests/android.test.InstrumentationTestRunner. And it actually works, it will run all my tests.

但是,当我做一个断点,并希望运行JUnit的时候进入调试模式,它失败了。这样,我做的断点工作,当我调试正常的Andr​​oid应用程序。

But when i make a breakpoints and wish to enter debug mode when running junit, it failed. The way i make breakpoints works when i debug normal android app.

所以,我搜索网站,并尝试像亚行外壳上午仪器-e调试真-e类com.android.contacts.AndroidUtilsTest -w com.android.contacts.tests / android.test。 InstrumentationTestRunner ,但仍然没有运气。如何你解决这个问题?我不只是要调试的JUnit类,也有code。在正常的项目。

So i searched web, and try something like adb shell am instrument -e debug true -e class com.android.contacts.AndroidUtilsTest -w com.android.contacts.tests/android.test.InstrumentationTestRunner, but still without luck. How do yours solve this problem? I not just want to debug the junit class, but also the code in normal project.

推荐答案

我猜你正在尝试调试使用Eclipse你的测试。如果是这样的话,你可以只选择测试项目,右键单击, 调试为... - > Android的JUnit测试的并执行将停在断点设置在测试中,或在code。

I guess you are trying to debug your tests using Eclipse. If this is the case you can just select you test project, right click, Debug As... -> Android JUNit test and the execution will stop at the breakpoints you set in your tests or in your code.