当唯一的信息是“测试运行失败”时,如何调试我的测试套件?
我正在为我正在启动的 Android 应用程序编写一些 jUnit 测试,并且遇到了一个非常奇怪的错误。当我在 Eclipse 中运行测试套件时(通过右键单击测试项目 -> 运行为 -> Android jUnit 测试,或者单击 Package explorer 旁边的 jUnit 选项卡中的“运行测试”按钮),它花费几秒钟构建并上传到模拟器,然后停止并显示一条红色消息,指出“测试运行失败”。
没关系,我可以忍受失败——除了没有关于失败的其他信息。 jUnit 选项卡不显示任何测试结果(没有成功,没有失败),“问题”选项卡没有给出任何内容,显然该东西是构建的,因为它加载到模拟器中,模拟器仍在运行(我打开并关闭了几个应用程序只是为了确定)。我尝试在调试模式下运行测试(调试为 -> Android jUnit 测试),但也没有异常或错误。
更新:我不确定DiagramClassTest中的测试用例是否被执行,因为方法开头的断点没有被命中(是的,我正在使用 Run 运行它作为 -> Android jUnit 测试)。然而,那里存在运行时错误。我没有重写 AndroidTestCase
构造函数,也没有做任何其他时髦的事情。
关于我接下来可以尝试什么来获取有关我的测试失败原因的一些信息,有什么建议吗?完整的控制台日志如下:
[2011-02-11 13:43:03 - RosterManagerTest] ------------------------------
[2011-02-11 13:43:03 - RosterManagerTest] Android Launch!
[2011-02-11 13:43:03 - RosterManagerTest] adb is running normally.
[2011-02-11 13:43:03 - RosterManagerTest] Performing android.test.InstrumentationTestRunner JUnit launch
[2011-02-11 13:43:03 - RosterManagerTest] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'default'
[2011-02-11 13:43:06 - RosterManagerTest] Application already deployed. No need to reinstall.
[2011-02-11 13:43:06 - RosterManagerTest] Project dependency found, installing: RosterManager
[2011-02-11 13:43:08 - RosterManager] Application already deployed. No need to reinstall.
[2011-02-11 13:43:08 - RosterManagerTest] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554
[2011-02-11 13:43:10 - RosterManagerTest] Collecting test information
[2011-02-11 13:43:14 - RosterManagerTest] Test run failed: org.hezmatt.RosterManager.test.DiagramClassTest
I'm writing some jUnit tests for an android app I'm starting on, and I've come up on a really weird error. When I run the test suite in Eclipse (either by right-clicking on the test project -> run as -> Android jUnit test, or by clicking the 'run test' button in the jUnit tab next to Package explorer), it spends a few seconds building and uploading to the emulator, and then just stops with a message in red saying that the "Test run failed".
That's fine, I can live with failure -- except there's no other information about what failed. The jUnit tab doesn't show any test results (no successes, no failures), the 'Problems' tab gives nothing, obviously the thing builds because it loaded into the emulator, the emulator's still running (I opened and closed a couple of apps just to make sure). I tried running the tests in debug mode (debug as -> Android jUnit test), but no exceptions or errors in there, either.
Update: I'm not sure that my test case in the DiagramClassTest is even getting executed, because a breakpoint at the beginning of the method doesn't get hit (yes, I'm running it with Run as -> Android jUnit test). Yet, there's a runtime error in there. I'm not overriding the AndroidTestCase
constructor, or doing anything else funky.
Any suggestions as to what I can try next to get some information on why my tests are failing? Complete console log below:
[2011-02-11 13:43:03 - RosterManagerTest] ------------------------------
[2011-02-11 13:43:03 - RosterManagerTest] Android Launch!
[2011-02-11 13:43:03 - RosterManagerTest] adb is running normally.
[2011-02-11 13:43:03 - RosterManagerTest] Performing android.test.InstrumentationTestRunner JUnit launch
[2011-02-11 13:43:03 - RosterManagerTest] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'default'
[2011-02-11 13:43:06 - RosterManagerTest] Application already deployed. No need to reinstall.
[2011-02-11 13:43:06 - RosterManagerTest] Project dependency found, installing: RosterManager
[2011-02-11 13:43:08 - RosterManager] Application already deployed. No need to reinstall.
[2011-02-11 13:43:08 - RosterManagerTest] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554
[2011-02-11 13:43:10 - RosterManagerTest] Collecting test information
[2011-02-11 13:43:14 - RosterManagerTest] Test run failed: org.hezmatt.RosterManager.test.DiagramClassTest
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论