开发者

Not hitting breakpoints debugging Android Junit tests in Eclipse

Getting an error running a Android unit test which extends ActivityInstrumentationTestCase2, and so want try and debug the test. However the break points are being ignored and when debug as Android Junit Test it gets to Running tests...

Here's the console log:

[2011-03-16 17:02:54 - AppName] Launching instrumen开发者_StackOverflowtation android.test.InstrumentationTestRunner on device [my device ID here]
[2011-03-16 17:02:55 - AppName] Collecting test information
[2011-03-16 17:02:55 - AppName] Test run failed: Process crashed.
[2011-03-16 17:02:55 - AppName] Test run finished
[2011-03-16 17:02:56 - AppName] Sending test information to Eclipse
[2011-03-16 17:02:56 - AppName] Running tests...

Any ideas?


It should look like this:

[2011-03-15 22:46:12 - TemperatureConverterTest] Collecting test information
[2011-03-15 22:46:13 - TemperatureConverterTest] Sending test information to Eclipse
[2011-03-15 22:46:13 - TemperatureConverterTest] Running tests...
**[2011-03-15 22:46:14 - TemperatureConverterTest] Attempting to connect debugger to 'com.example.aatg.tc' on port 8654**
[2011-03-15 22:46:31 - TemperatureConverterTest] Test run finished

Notice that your test is crashing even before getting the debugger connected. There might be a problem in you constructor.


Check if the application you are testing has defined android:debuggable="true".

If your application is not debuggable, running the tests in debug mode does not work. E.g. you will not hit any breakpoints and you get the error message in the log as mentioned above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜