当我尝试在JUnit中运行一个类作为Android Eclipse测试时,我得到了常见的“启动测试失败”错误。然而,当试图在JUnit中以Android Eclipse测试的形式运行一个包时,它可以工作--这意味着我已经正确地配置了所有东西,但是我的CustomInstrumentationTestRunner中有一个错误。我的问题是:我在哪里可以找到关于发生了什么的更详细的信息,而不是无用的模糊的“无法启动测试”?或者至少是用于运行我的CustomInstrumentationTestRunner的命令。
logcat中没有任何关于启动任何测试的内容(但logcat显示apks确实安装正确),也没有任何警告或失败。在Eclipse的日志(.adata/.log)中,也没有任何警告、失败或任何与启动测试相关的内容。我猜这个问题已经在eclipse的ADT插件中表达出来了。它的日志在哪里?我甚至贪婪地在Eclipse的.metadata文件夹中输入“失败”和“启动测试”,但什么也没有。啊。堆栈跟踪在哪里?给。它。转到。我...现在。
这是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发布于 2014-02-13 22:45:22
没有任何日志,也没有堆栈跟踪:(.该异常将被完全忽略。
来源: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;
}https://stackoverflow.com/questions/21756845
复制相似问题