google / Accessibility-Test-Framework-for-Android

Accessibility checks for automated Android testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about custom AccessibilityHierarchyCheck

MarinKacaj opened this issue · comments

Hello!

I'm looking into adding a few custom AccessibilityHierarchyChecks for my project, however I noticed that if I want to do that, I have to provide my own subclass of AccessibilityHierarchyCheckResult.
Reason is that AccessibilityHierarchyCheckResult has a private method, getChecks(), which makes sure the check is one of the presets from AccessibilityCheckPreset.CLASS_TO_HIERARCHY_CHECK, by calling AccessibilityCheckPreset.getHierarchyCheckForClass(...).

I'm wondering if it's possible to decouple the two: AccessibilityHierarchyCheckResult and AccessibilityCheckPreset.

I understand that the current pattern makes it possible to instantiate checks only once, and thus allows access to them through a singleton, which, in turns, uses a variation of the service locator pattern. Is it possible, for example, to add another layer of indirection, for example, a singleton called AccessibilityChecksAggregator, which can be configured to take in the preset or a custom set of checks before tests run?

P.S.: I'm not adding a Contributor License Agreement since I'm not contributing with any code or any tangible value, at least not yet.

Thank you for the suggestion. This limitation has been noted a few times before, so we will look into making it easier to extend the set of checks.