Need help with Accessibility-Test-Framework-for-Android?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

google
247 Stars 80 Forks Apache License 2.0 33 Commits 3 Opened issues

Services available

!
?

Need anything else?

Contributors list

Accessibility Test Framework for Android

To help people with disabilities access Android apps, developers of those apps need to consider how their apps will be presented to accessibility services. Some good practices can be checked by automated tools, such as if a View has a contentDescription. Other rules require human judgment, such as whether or not a contentDescription makes sense to all users.

For more information about Mobile Accessibility, see: http://www.w3.org/WAI/mobile/

This library collects various accessibility-related checks on View objects as well as AccessibilityNodeInfo objects (which the Android framework derives from Views and sends to AccessibilityServices).

Building the Library

The supplied gradle wrapper and build.gradle file can be used to build the Accessibility Test Framework or import the project into Android Studio.

$ ./gradlew build

Sample Usage

Given a view, the following code runs all accessibility checks on all views in the hierarchy rooted at that view and throws an exception if any errors are found:

ImmutableSet checks =
    AccessibilityCheckPreset.getAccessibilityHierarchyChecksForPreset(
        AccessibilityCheckPreset.LATEST);
AccessibilityHierarchyAndroid hierarchy = AccessibilityHierarchyAndroid.newBuilder(view).build();
List results = new ArrayList<>();
for (AccessibilityHierarchyCheck check : checks) {
  results.addAll(check.runCheckOnHierarchy(hierarchy));
}
List errors =
    AccessibilityCheckResultUtils.getResultsForType(
        results, AccessibilityCheckResultType.ERROR);
if (errors.size() > 0) {
  throw new RuntimeException(errors.get(0).getMessage().toString());
}

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.