Apple iOS iPhone UI Automation Testing: What does Accessibility have to do with it?

September 4, 2010    

Trying to do some UI Automation testing going on one of my Apps today. Have a race condition, so I want to have a script to run it over and over again to have a better chance of catching the problem (more on that in a later post).

So, I just wasted 2 hours trying to test this structure:

And the problem was that I had this set in Interface Builder:

( Emphasis mine).

Now, this page says that container views shouldn’t be set as Accessible. What it DOESN’T say (unless I missed it) is that IF the container view IS Accessible, then NONE of the subViews will be checked for Accessibility AT ALL. In essence, any Accessible object is a leaf as far as Accessibility is concerned. So even if you have:

set, which is correct, your TextField is UNTESTABLE. The UI Automation scripts can’t find it at all. As soon as you do:

in the parent UIView, then it all works.

You’ve been warned. Don’t be like me.

I have this feeling that I’ll be running into more fun tips and tricks by the time I get this all working. I’ll post them here as they find me. Wish me Luck.