Choose Your Own Adventure with Environment Variables

We fixed a performance bug and verified behavior with our generated test data, but we don’t want to have to manually change the Objective-C code when we want to choose a data scenario. Instead we’ll choose which message to send to the data factory on the fly during application launch based on an environment-variable value.

Every Unix process, including iOS and OS X apps, has a set of variables made visible through that process’s environment. We can assign any string value we want to these environment variables through Xcode schemes, as we’ll see in a moment, and even from the command line, which we’ll use in Chapter 10, Command-Line Workflow.

Rather than hard-code the call to generate ...

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.