Importing Script Files at Runtime

At the moment, we have two individual tests that we want to run one after the other. Embedding scripts in UI Automation’s editor is useful and convenient, but it’s not the best way to maintain our test scripts long-term. Instead we will have the Instruments trace document reference a master script on the file system. This script can then import other script files at runtime. Using these techniques, we’ll be able to run both our tests in the right order and still keep them separate.

Let’s construct this master script in place and then export it to a file. Create a blank script in the automation-script editor and type in these #import statements to tell the scripting engine that we want to pull other files into ...

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.