Wrapping Service APIs in a Facade

Imagine this scenario: an app needs to authenticate with Facebook using OAuth. We trigger a URL launching Mobile Safari so the user can log in. After authenticating, Facebook kicks the user back to the app with the token that gives us what we need. How would we test that?

Unfortunately, we can’t. Apple doesn’t expose any interprocess control to us through the automation interface. Once the app goes in the background, we’re out of luck. Since Mobile Safari wasn’t launched by Instruments, we can’t talk to it from our tests.

In-app purchasing, Game Kit, and iCloud are other situations that are out of our control. We may want to test how our UI behaves if the user has purchased an item or not, but we don’t want ...

Get Test iOS Apps with UI Automation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.