New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 669946 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
not available
Closed: Jan 14
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

RobotiumBundleGenerator.java uses deprecated InstrumentationTestRunner in android.test

Project Member Reported by thakis@chromium.org, Nov 30 2016

Issue description

I get this when building:



[1416/1919] ACTION //testing/android/appurify_support:appurify_support_java__compile_java__javac(//build/toolchain/android:android_clang_arm)
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:9: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
import android.test.InstrumentationTestRunner;
                   ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:36: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                    InstrumentationTestRunner.REPORT_VALUE_ID);
                    ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:38: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                    InstrumentationTestRunner.REPORT_KEY_NAME_CLASS, result.getTestClass());
                    ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:40: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                    InstrumentationTestRunner.REPORT_KEY_NAME_TEST, result.getTestName());
                    ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:42: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                    InstrumentationTestRunner.REPORT_KEY_NUM_CURRENT, result.getTestIndex());
                    ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:43: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
            startBundle.putInt(InstrumentationTestRunner.REPORT_KEY_NUM_TOTAL, totalTests);
                               ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:47: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                    InstrumentationTestRunner.REPORT_VALUE_RESULT_START, startBundle));
                    ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:54: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                            InstrumentationTestRunner.REPORT_VALUE_RESULT_OK, resultBundle));
                            ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:61: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                            InstrumentationTestRunner.REPORT_KEY_STACK, result.getLog());
                            ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:63: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                            InstrumentationTestRunner.REPORT_VALUE_RESULT_FAILURE, resultBundle));
                            ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:67: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                            InstrumentationTestRunner.REPORT_VALUE_RESULT_ERROR, resultBundle));
                            ^
../../testing/android/appurify_support/java/src/org/chromium/test/support/RobotiumBundleGenerator.java:73: warning: [deprecation] InstrumentationTestRunner in android.test has been deprecated
                            InstrumentationTestRunner.REPORT_VALUE_RESULT_ERROR, resultBundle));
                            ^
12 warnings


Probably after updating SDKs. Normally we block SDK updates on fixing warnings, but java doesn't have -Werror to make the bots do that. Please treat this high-priority. We want our build to be silent.
 
Owner: yolandyan@chromium.org
Status: Assigned (was: Untriaged)
Yeah, InstrumentationTestRunner was deprecated starting in API level 24. While RobotiumBundleGenerator should be straightforward to address on its own, that's not true for our other uses of InstrumentationTestRunner & Android's JUnit3-based test framework.
So the public static ints referenced here are moved to InstrumentationResultPrinter.java

1. We can change the reference to InstrumentationResultPrinter.REPORT_VALUE_...
however InstrumentationResultPrinter is an Android internal public class (android.support.test.internal.runner.listener.InstrumentationResultPrinter), there isn't a precedent example of any internal class reference from android chrome's code base. We need to add android_test_support as a dependency in "appurify_support"

2. We can just store these ints in a file in /base (e.g. BaseJUnitClassRunner.REPORT_VALUE..) and reference from there, since these values might be used some where else in our code base and these values doesn't really change (they might get deprecated, but if REPORT_VALUE_RESULT_ERROR suddenly change from 1 to 2, it would cause huge problem)

3. We can just temporarily store these ints in RobotiumBundleGenerator.java, that saves us from adding deps to "appurify_support" target

PS: link to InstrumentationResultPrinter
https://android.googlesource.com/platform/frameworks/testing/+/master/support/src/android/support/test/internal/runner/listener/InstrumentationResultPrinter.java

Status: Archived (was: Assigned)

Sign in to add a comment