没有在Eclipse中调试Android Junit测试的断点

时间:2011-03-16 17:15:26

标签: android debugging junit

运行扩展ActivityInstrumentationTestCase2的Android单元测试时出错,因此需要尝试并调试测试。但是,断点被忽略,当调试为Android Junit Test时,它会运行测试......

这是控制台日志:

[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...

有什么想法吗?

2 个答案:

答案 0 :(得分:2)

它应该是这样的:

[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

请注意,即使在连接调试器之前,您的测试也会崩溃。 您的构造函数可能存在问题。

答案 1 :(得分:1)

检查您正在测试的应用程序是否定义了android:debuggable =“true”。

如果您的应用程序不可调试,则在调试模式下运行测试不起作用。例如。你不会遇到任何断点,如上所述,你会在日志中收到错误信息。