Seeding Data in Xcode with Application Data Packages

For our first technique, we’re going to use a feature of Xcode schemes that lets us specify an application data package to load into the simulator or device alongside the app when built and run from the Xcode GUI. This package completely replaces whatever is in the application’s sandbox, effectively resetting documents and preferences. You can pull these packages off live devices, so it’s a great way to take a snapshot of state you want to save for later.

To learn this technique, we’ll write a behavior test for the sorting in NearbyMe that depends on a specific set of search terms. We’ll first create an application data package that we’ll use as a baseline. We’ll store this data package ...

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.