0

I have implemented a custom response to the “Perform Escape” (two-finger Z) VoiceOver gesture for a modal view (via the accessibilityPerformEscape() -> Bool method in my UIViewController subclass). I’ve manually tested it on an iPhone device and it works as expected.

What I want to do now is add a test to my UI Tests suite to ensure that the behaviour continues to work, as changes are made to the project. (I.E., the whole point of UI testing.)

I have not been able to find any reference to automated testing of VoiceOver gestures for iOS UI testing (XCTest, et. al.).

So: How can I automate testing of VoiceOver gestures?

Since it seems that this is not supported in the Simulator, am I going to have to always connect an iOS device to my development computer (and eventually CI server, when I set that up) in order to run VoiceOver UI tests?

Grant Neufeld
  • 549
  • 1
  • 9
  • 18
  • 2
    I notice that a couple people have voted this question down. Would it be too much trouble to ask what you don’t like about this question? What would you want changed to make it acceptable to you? Thanks. – Grant Neufeld Jan 11 '20 at 00:55

1 Answers1

4

How can I automate testing of VoiceOver gestures?

Actually, you can't because the UITesting framework doesn't access the application code as unit tests do.
Automatically testing the VoiceOver gestures is unfortunately something you can't process at the present time (Xcode 11, iOS 13).

However, this source provides many useful information with tests to be done for a11y if need be.

Take a look at the following answers dealing with the same situation:

XLE_22
  • 5,124
  • 3
  • 21
  • 72
  • Yeah. I’m already testing the accessibility of my apps—and I understand the difference between Unit tests accessing code and UI tests not. What I want is automation of testing the accessible interface interactions (as behaviour/UI tests, not unit tests) so that as I continue to add/modify my projects’ code I can catch regressions (just like with UI tests for the “regular” interface stuff). But I guess Apple is only half-way supporting accessibility in not providing a means to do automated testing of interactions/behaviours like with other views/controls/etc. – Grant Neufeld Jan 11 '20 at 00:54
  • @GrantNeufeld: UITesting is great with iOS but definitely not with its accessibility part, unfortunately. So, the answer to your initial question is that you can't do automated testing for VoiceOver, just forget it until Apple improves its IDE to make it the right way. – XLE_22 Feb 19 '20 at 13:32