google / Accessibility-Test-Framework-for-Android

Accessibility checks for automated Android testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ATF framework is not able to identify Resource

FennyR opened this issue · comments

I am this ATF framework in my project. With library, I am able to successfully identify the Accessibiliy violation. But after identifying the violation, the code is trying to return the link with violation details. Here at this step, the library is failing and giving Resource Not Found exception for any language selected. I am attaching the exception below. Please look into it and respond.

java.util.MissingResourceException: Can't find bundle for base name com.google.android.apps.common.testing.accessibility.framework.strings, locale en
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1558)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1381)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at java.util.ResourceBundle.getBundle(ResourceBundle.java:1300)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at com.google.android.apps.common.testing.accessibility.framework.strings.StringManager.getResourceBundle(StringManager.java:33)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at com.google.android.apps.common.testing.accessibility.framework.strings.StringManager.getString(StringManager.java:27)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at com.google.android.apps.common.testing.accessibility.framework.checks.SpeakableTextPresentCheck.generateMessageForResultId(SpeakableTextPresentCheck.java:148)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at com.google.android.apps.common.testing.accessibility.framework.checks.SpeakableTextPresentCheck.getMessageForResultData(SpeakableTextPresentCheck.java:125)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at com.google.android.apps.common.testing.accessibility.framework.AccessibilityHierarchyCheck.getMessageForResult(AccessibilityHierarchyCheck.java:74)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at com.google.android.apps.common.testing.accessibility.framework.AccessibilityHierarchyCheckResult.getRawMessage(AccessibilityHierarchyCheckResult.java:129)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at com.google.android.apps.common.testing.accessibility.framework.AccessibilityHierarchyCheckResult.getMessage(AccessibilityHierarchyCheckResult.java:143)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at service.FloatingCircle.onAccessibilityEvent(FloatingCircle.java:442)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at android.accessibilityservice.AccessibilityService$2.onAccessibilityEvent(AccessibilityService.java:1561)
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at android.accessibilityservice.AccessibilityService$IAccessibilityServiceClientWrapper.executeMessage(AccessibilityService.java:1747)

Exception: "java.util.MissingResourceException: Can't find bundle for base name com.google.android.apps.common.testing.accessibility.framework.strings, locale en
2019-12-26 12:25:32.595 11773-11773/com.example.systemoverlaydemo W/System.err: at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1558)"

facing the same exception of any language selection.

We've made a number of changes around string management and translation in our latest v3.1 release, which was just merged to master. Please sync the latest source and please let us know if you're still running into issues here.

This is also happening for me. I am unable to get this to work in the Robolectric environment.

Also happening in the androidTest Espresso tests

Thanks for the update @FennyR and @sunyal. Updated logs appreciated, and I'll start looking into repro'ing this today.

Hello. Any news?

@caseyburkhardt
I'm getting the same error with v3.0 as well.

Thanks for bearing with us on this. We've revised our approach to packaging resources, which gets a bit complicated with a few of our internal release variants of the library. This should now be resolved with the latest push.

I am still receiving this exception in 3.1. This is coming from a test using ParameterizedRobolectricTestRunner. If you would rather me open a new issue, let me know.

    java.util.MissingResourceException: Can't find bundle for base name .strings, locale en_US
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1581)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1396)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:1308)
        at com.google.android.apps.common.testing.accessibility.framework.strings.StringManager.getResourceBundle(StringManager.java:63)
        at com.google.android.apps.common.testing.accessibility.framework.strings.StringManager.getString(StringManager.java:42)
        at com.google.android.apps.common.testing.accessibility.framework.checks.RedundantDescriptionCheck.checkForWords(RedundantDescriptionCheck.java:185)
        at com.google.android.apps.common.testing.accessibility.framework.checks.RedundantDescriptionCheck.runCheckOnHierarchy(RedundantDescriptionCheck.java:158)
        at com.google.android.apps.common.testing.accessibility.framework.AccessibilityViewHierarchyCheck.runDelegationCheckOnView(AccessibilityViewHierarchyCheck.java:101)
        at com.google.android.apps.common.testing.accessibility.framework.RedundantContentDescViewCheck.runCheckOnViewHierarchy(RedundantContentDescViewCheck.java:38)
        at com.google.android.apps.common.testing.accessibility.framework.integrations.espresso.AccessibilityValidator.runAccessibilityChecks(AccessibilityValidator.java:225)
        at com.google.android.apps.common.testing.accessibility.framework.integrations.espresso.AccessibilityValidator.checkAndReturnResults(AccessibilityValidator.java:87)
        at androidx.test.espresso.accessibility.AccessibilityChecks$2.check(AccessibilityChecks.java:65)

Reopening for some additional investigation, although we were unable to reproduce this when we were validating the 3.1 release candidate.

@ekimmel-ta Can you clarify if you're building the project from source, or from our Maven artifact? Any other information to help us reproduce this is appreciated.

This is pulling down the 3.1 maven artifact. I am using Espresso 3.3.0, and forcing the ATF resolution to be 3.1 while waiting for that team to merge the update officially.

I will work on reproducing the issue in a sample project.

Here is a minimal example showcasing the exception. https://github.com/ekimmel-ta/ATFSample

Hi ekimmel-ta,

Sorry for the delay. After much debugging, I think we've identified the issue. Gradle is not packaging files in the assets/ directory into unit tests. It packages them fine in the application process or Espresso tests. I think we can fix this by using the Java-style resources/ directory, instead. Working on the fix now; I'll update the issue when it's out, and we can see if that fixes your sample.

Hi ekimmel-ta,

We just pushed a new version to Maven. Can you try pulling 3.1.1 and see if it works?

Hello! I've pulled in the latest version.

Some behavior seems to have changed between v2 and v3 regarding the root view being tested for accessibility, even if it doesn't match the "suppressing result matcher". After marking some of the scaffolding of our test layout as not important for accessibility, the tests do indeed succeed! Thank you for the patch!

Some behavior changes are expected between versions of ATF, as we roll out new accessibility checks, fix bugs, and (hopefully) introduce fewer new bugs.

If you suspect the results you're receiving are not accurate, please do open a separate issue with a minimal repro example of your layout, and we'd be more than happy to take a look.

Hello, I'm still running into this issue on version 3.4.0 of the Espresso Accessibility testing library. Is there a fix for this issue, or should we be using a specific version?