android / android-test

An extensive framework for testing Android apps
https://android.github.io/android-test
Apache License 2.0
1.16k stars 315 forks source link

getCauseStackTraceLines throws StringIndexOutOfBoundsException #2306

Open mr-thierry opened 4 weeks ago

mr-thierry commented 4 weeks ago

Description

Exception in the test runner

Steps to Reproduce

Generate a failure during a test

Expected Results

Test orchestrator generate the test report successfully

Actual Results

This is the stacktrace that shows the exception:

10-28 12:00:57.213  7455  7485 E TestRunner: java.lang.StringIndexOutOfBoundsException: length=117; index=290
10-28 12:00:57.213  7455  7485 E TestRunner:    at java.lang.String.substring(String.java:1999)
10-28 12:00:57.213  7455  7485 E TestRunner:    at androidx.test.services.events.internal.Throwables.getCauseStackTraceLines(Throwables.java:70)
10-28 12:00:57.213  7455  7485 E TestRunner:    at androidx.test.services.events.internal.Throwables.getTrimmedStackTrace(Throwables.java:38)
10-28 12:00:57.213  7455  7485 E TestRunner:    at androidx.test.services.events.internal.StackTrimmer.getTrimmedStackTrace(StackTrimmer.java:37)
10-28 12:00:57.213  7455  7485 E TestRunner:    at androidx.test.services.events.ParcelableConverter.getFailure(ParcelableConverter.java:106)
10-28 12:00:57.213  7455  7485 E TestRunner:    at androidx.test.services.events.ParcelableConverter.getFailuresFromList(ParcelableConverter.java:119)
10-28 12:00:57.213  7455  7485 E TestRunner:    at androidx.test.internal.events.client.OrchestratedInstrumentationListener.testRunFinished(OrchestratedInstrumentationListener.java:84)
10-28 12:00:57.213  7455  7485 E TestRunner:    at org.junit.runner.notification.SynchronizedRunListener.testRunFinished(SynchronizedRunListener.java:42)
10-28 12:00:57.213  7455  7485 E TestRunner:    at org.junit.runner.notification.RunNotifier$2.notifyListener(RunNotifier.java:103)
10-28 12:00:57.213  7455  7485 E TestRunner:    at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
10-28 12:00:57.213  7455  7485 E TestRunner:    at org.junit.runner.notification.RunNotifier.fireTestRunFinished(RunNotifier.java:100)
10-28 12:00:57.213  7455  7485 E TestRunner:    at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
10-28 12:00:57.213  7455  7485 E TestRunner:    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
10-28 12:00:57.213  7455  7485 E TestRunner:    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:68)
10-28 12:00:57.213  7455  7485 E TestRunner:    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)

AndroidX Test and Android OS Versions

androidx.test:runner:1.6.2 on API 28

Link to a public git repo demonstrating the problem: