O'Reilly logo

Test iOS Apps with UI Automation by Jonathan Penn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required