scottyab
scottyab

Reputation: 24039

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 instrumentation 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?

Upvotes: 5

Views: 3783

Answers (2)

Thomas Feilkas
Thomas Feilkas

Reputation: 11

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.

Upvotes: 1

Diego Torres Milano
Diego Torres Milano

Reputation: 69228

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.

Upvotes: 2

Related Questions