Skip to content

Commit e99c39f

Browse files
agrievecopybara-androidxtest
authored andcommitted
When logging test exceptions, use Log's built-in support for throwables to avoid truncation
PiperOrigin-RevId: 612563145
1 parent cf6f857 commit e99c39f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

runner/android_junit_runner/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
**Bug Fixes**
88

9+
* When logging test exceptions, use Log's built-in support for throwables to avoid stack truncation
10+
11+
912
**New Features**
1013

1114
**Breaking Changes**

runner/android_junit_runner/java/androidx/test/internal/runner/listener/LogRunListener.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,14 @@ public void testFinished(Description description) throws Exception {
5858
@Override
5959
public void testFailure(Failure failure) throws Exception {
6060
Log.e(TAG, "failed: " + failure.getDescription().getDisplayName());
61-
Log.e(TAG, "----- begin exception -----");
62-
Log.e(TAG, failure.getTrace());
61+
Log.e(TAG, "----- begin exception -----", failure.getException());
6362
Log.e(TAG, "----- end exception -----");
6463
}
6564

6665
@Override
6766
public void testAssumptionFailure(Failure failure) {
6867
Log.e(TAG, "assumption failed: " + failure.getDescription().getDisplayName());
69-
Log.e(TAG, "----- begin exception -----");
70-
Log.e(TAG, failure.getTrace());
68+
Log.e(TAG, "----- begin exception -----", failure.getException());
7169
Log.e(TAG, "----- end exception -----");
7270
}
7371

0 commit comments

Comments
 (0)