From 35421a395afd413a53dd42236320d210d493e4d5 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 13 Jun 2012 16:31:01 -0400 Subject: [PATCH] Bug 764527 - Catch exceptions thrown during robocop tests. r=jmaher --- mobile/android/base/tests/BaseTest.java.in | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mobile/android/base/tests/BaseTest.java.in b/mobile/android/base/tests/BaseTest.java.in index 52abd6b46f3..593049dce64 100644 --- a/mobile/android/base/tests/BaseTest.java.in +++ b/mobile/android/base/tests/BaseTest.java.in @@ -74,6 +74,20 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2 { mRawBaseUrl = ((String)config.get("rawhost")).replaceAll("(/$)", ""); } + @Override + protected void runTest() throws Throwable { + try { + super.runTest(); + } catch (Throwable t) { + if (mAsserter != null) { + mAsserter.dumpLog("Exception caught during test!", t); + mAsserter.ok(false, "Exception caught", t.toString()); + } + // re-throw to continue bail-out + throw t; + } + } + public void setTestType(String type) { mTestType = type;