Eclipse 4.3中的Android控制台中“无法启动测试”。哪里可以找到实际发生的事情?

时间:2014-02-13 14:21:41

标签: android eclipse adt eclipse-adt

当尝试在Eclipse中作为Android JUnit Test运行类时,我得到了常见的“未通过测试”错误。但是,当尝试在Eclipse中运行一个包作为Android JUnit Test时,它可以工作 - 这意味着我已经正确配置了所有内容但是我的CustomInstrumentationTestRunner中出现了错误。我的问题是:我在哪里可以找到有关发生的事情的更详细信息,而不是无用的模糊“未通过测试”?或者至少用于运行我的CustomInstrumentationTestRunner的命令。

logcat中没有任何关于启动任何测试的内容(但是logcat显示apx确实已正确安装)并且没有警告或失败。 在Eclipse的日志(.metadata / .log)中启动测试也没有任何警告,失败或任何相关内容。我的猜测是问题是在eclipse的ADT插件中表达的。它的日志在哪里?我甚至在Eclipse的.metadata文件夹中搜索“Failed to”和“lauch test”,什么都没有。哎呀。堆栈跟踪在哪里?给。它。至。我......现在。

这是Android控制台中的输出:

[2014-02-13 13:50:17 - test-project] ------------------------------
[2014-02-13 13:50:17 - test-project] Android Launch!
[2014-02-13 13:50:17 - test-project] adb is running normally.
[2014-02-13 13:50:17 - test-project] Performing android.test.CustomInstrumentationTestRunner JUnit launch
[2014-02-13 13:50:18 - test-project] Automatic Target Mode: using device '007bfc69d34ca4ee'
[2014-02-13 13:50:18 - test-project] Uploading test-project.apk onto device '007bfc69d34ca4ee'
[2014-02-13 13:50:18 - test-project] Installing test-project.apk...
[2014-02-13 13:50:24 - test-project] Success!
[2014-02-13 13:50:24 - test-project] Project dependency found, installing: project
[2014-02-13 13:50:24 - project] Uploading project.apk onto device '007bfc69d34ca4ee'
[2014-02-13 13:50:29 - project] Installing project.apk...
[2014-02-13 13:50:50 - project] Success!
[2014-02-13 13:50:50 - test-project] Launching instrumentation android.test.CustomInstrumentationTestRunner on 007bfc69d34ca4ee
[2014-02-13 13:50:50 - test-project] Failed to launch test

1 个答案:

答案 0 :(得分:0)

没有任何日志,也没有堆栈跟踪:(。例外被完全忽略。

来源位于:http://osxr.org/android/source/sdk/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/AndroidJUnitLaunchAction.java

相关部分:

 /**
  * Launch a instrumentation test run on given Android device.
  * Reuses JDT JUnit launch delegate so results can be communicated back to JDT JUnit UI.
  * <p/>
  * Note: Must be executed on non-UI thread.
  *
  * @see IAndroidLaunchAction#doLaunchAction(DelayedLaunchInfo, IDevice)
  */
 @Override
 public boolean doLaunchAction(DelayedLaunchInfo info, IDevice device) {
     String msg = String.format(LaunchMessages.AndroidJUnitLaunchAction_LaunchInstr_2s,
             mLaunchInfo.getRunner(), device.getSerialNumber());
     AdtPlugin.printToConsole(info.getProject(), msg);

     try {
        mLaunchInfo.setDebugMode(info.isDebugMode());
        mLaunchInfo.setDevice(info.getDevice());
        JUnitLaunchDelegate junitDelegate = new JUnitLaunchDelegate(mLaunchInfo);
        final String mode = info.isDebugMode() ? ILaunchManager.DEBUG_MODE :
            ILaunchManager.RUN_MODE;

        junitDelegate.launch(info.getLaunch().getLaunchConfiguration(), mode, info.getLaunch(),
                info.getMonitor());

        // TODO: need to add AMReceiver-type functionality somewhere
     } catch (CoreException e) {
         AdtPlugin.printErrorToConsole(info.getProject(),
                 LaunchMessages.AndroidJUnitLaunchAction_LaunchFail);
     }
     return true;
 }