Search code examples
xcodegeolocationlocationxcode-ui-testingui-testing

Change Simulator Location using Xcode's UITesting


Just wondering if it is possible to use UITesting in xcode to somehow code in custom locations for the simulator. We have an app that involves a number of location changes and would be great if we could automate the changes in location as part of our UITesting suite.


Solution

  • Found another question similar to this one so thought I would reuse the answer I just posted there:

    "I think the best approach to this will be to use GPX files. These allow you to set the lat and long of a location. (For more details see here: https://blackpixel.com/writing/2013/05/simulating-locations-with-xcode.html)

    However, I suspect you will need to call these from within the app itself and then use UI testing launch arguments (when you launch XCUIApplication) to stipulate which GPX files to use depending upon the test."