From: epriestley Date: Thu, 17 Nov 2011 19:12:17 +0000 (-0800) Subject: Provide more information when unit tests fail with exceptions X-Git-Tag: conduit-4~233 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=a8b42312445b6e8f58afab8686e5464d8823263c;p=arcanist.git Provide more information when unit tests fail with exceptions Summary: When a unit test throws an exception, provide more data (type, trace) in the test failure message. Previously, we would show only the message itself, which may not be very useful in debugging test failures. Test Plan: Ran "arc unit" on a test which throws, got a stack trace. Reviewers: edward, btrahan, jungejason, nh, tuomaspelkonen, aran Reviewed By: nh CC: aran, nh Differential Revision: 1123 --- diff --git a/src/unit/engine/phutil/testcase/ArcanistPhutilTestCase.php b/src/unit/engine/phutil/testcase/ArcanistPhutilTestCase.php index 59cc7bc6..2b8b8c27 100644 --- a/src/unit/engine/phutil/testcase/ArcanistPhutilTestCase.php +++ b/src/unit/engine/phutil/testcase/ArcanistPhutilTestCase.php @@ -231,7 +231,11 @@ abstract class ArcanistPhutilTestCase { } catch (ArcanistPhutilTestTerminatedException $ex) { // Continue with the next test. } catch (Exception $ex) { - $this->failTest($ex->getMessage()); + $ex_class = get_class($ex); + $ex_message = $ex->getMessage(); + $ex_trace = $ex->getTraceAsString(); + $message = "EXCEPTION ({$ex_class}): {$ex_message}\n{$ex_trace}"; + $this->failTest($message); } } }