diff options
Diffstat (limited to 'eclipse')
3 files changed, 27 insertions, 17 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchMessages.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchMessages.java index c105215..d09ddff 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchMessages.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchMessages.java @@ -42,6 +42,8 @@ public class LaunchMessages extends NLS { public static String InstrValidator_WrongRunnerTypeMsg_s; public static String RemoteAdtTestRunner_RunCompleteMsg; public static String RemoteAdtTestRunner_RunFailedMsg_s; + + public static String RemoteAdtTestRunner_RunIOException_s; public static String RemoteAdtTestRunner_RunStoppedMsg; static { diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/runtime/RemoteAdtTestRunner.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/runtime/RemoteAdtTestRunner.java index af87254..0a045bc 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/runtime/RemoteAdtTestRunner.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/runtime/RemoteAdtTestRunner.java @@ -27,6 +27,8 @@ import org.eclipse.jdt.internal.junit.runner.RemoteTestRunner; import org.eclipse.jdt.internal.junit.runner.TestExecution; import org.eclipse.jdt.internal.junit.runner.TestReferenceFailure; +import java.io.IOException; + /** * Supports Eclipse JUnit execution of Android tests. * <p/> @@ -98,24 +100,29 @@ public class RemoteAdtTestRunner extends RemoteTestRunner { // set log only to first collect test case info, so Eclipse has correct test case count/ // tree info runner.setLogOnly(true); - TestCollector collector = new TestCollector(); - runner.run(collector); - if (collector.getErrorMessage() != null) { - // error occurred during test collection. - reportError(collector.getErrorMessage()); - // abort here - notifyTestRunEnded(0); - return; - } - notifyTestRunStarted(collector.getTestCaseCount()); - collector.sendTrees(this); - - // now do real execution - runner.setLogOnly(false); - if (mLaunchInfo.isDebugMode()) { - runner.setDebug(true); + TestCollector collector = new TestCollector(); + try { + runner.run(collector); + if (collector.getErrorMessage() != null) { + // error occurred during test collection. + reportError(collector.getErrorMessage()); + // abort here + notifyTestRunEnded(0); + return; + } + notifyTestRunStarted(collector.getTestCaseCount()); + collector.sendTrees(this); + + // now do real execution + runner.setLogOnly(false); + if (mLaunchInfo.isDebugMode()) { + runner.setDebug(true); + } + runner.run(new TestRunListener()); + } catch (IOException e) { + reportError(String.format(LaunchMessages.RemoteAdtTestRunner_RunIOException_s, + e.getMessage())); } - runner.run(new TestRunListener()); } /** diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/messages.properties b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/messages.properties index 756aa61..67c9116 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/messages.properties +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/messages.properties @@ -35,4 +35,5 @@ InstrValidator_NoTestLibMsg_s=The application does not declare uses-library %1$s InstrValidator_WrongRunnerTypeMsg_s=The instrumentation runner must be of type %1$s RemoteAdtTestRunner_RunCompleteMsg=Test run complete RemoteAdtTestRunner_RunFailedMsg_s=Test run failed: %1$s +RemoteAdtTestRunner_RunIOException_s=Test run failed. Lost connection with device: %s RemoteAdtTestRunner_RunStoppedMsg=Test run stopped |