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

Starting a JavaScript Toolbox

As we’ve been writing the test code, we’ve seen some common patterns. For each of the three test scripts, we’re writing a lot of boilerplate JavaScript code to set up, assert, and log the output. If we take some time to consider what we’ve done and extract the common parts to a reusable test environment, we can import that environment everywhere we need it, like a handy toolbox.

We’ll think through three specific cases where we can simplify the verbose syntax of UI Automation. Each of these functions will be declared globally and available everywhere. We shouldn’t do that lightly since we want to keep the global namespace free of cruft, but the convenience is compelling. We’ll look at some of the reasoning behind ...

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