Mobile Accessibility Quick Win — Start UI Testing

Rob Whitaker
2 min readAug 5, 2021

I’ll admit, adding UI testing to an app that currently doesn’t have it included is probably stretching the definition of quick win, but the aim here isn’t 100% coverage — not right away anyway. Start small and add to your test suite as you gain confidence. Even a small suite of crucial happy-path UI tests will help to ensure and persist accessibility in your app. And the more you get comfortable with UI tests the more accessible your apps will become, because an app that is easy to test is also great for accessibility.

iOS

XCUI tests are great for accessibility because thats exactly what they’re testing. The tests need something machine-readable to understand what is present on screen — something else that needs something machine-readable to understand the screen is assistive technologies. So XCUI reads the accessibility tree, the hierarchy of metadata and labels that represent to assistive technology what is on screen. This means the easier your app is to UI test, the more robust the accessibility experience is. In short — any XCUI test is an accessibility test.

Paul Hudson provides this great tutorial on getting started with testing your user interface and a cheat sheet for when you want to go a little further. There are a couple of caveats for ensuring your tests are checking accessibility — reference elements by their label wherever possible. Referencing by index or identifier can make finding elements on screen easier, but be sure to check the element’s label once…

--

--

Rob Whitaker

iOS Engineer at Capital One. Author, Developing Inclusive Mobile Apps, Apress. https://amzn.to/3aNRQ6d