Sitting at your desk on the last day before vacation. Waiting for your appointment to start at the dentist’s office. Sitting in rush hour traffic on the drive home. These are just a few instances where you might pretend to be somewhere — anywhere — else. But this sort of “make-believe” isn’t always relegated to daydreaming your way out of tough situations. QA testers often pretend to be somewhere else . . . every single day! Testing is about mimicking the actual user experience in real environments — so in order to test for every single one of your users, testers must know how to test location services so they can pretend to be anywhere users may be.
The Value of Location Services
![Woman standing on a cliff overlooking a body of water and tree-covered mountains; she is taking a photo of the scene.](https://cdn.prod.website-files.com/660a4cd9206686f4fc7ccf44/660a4de65f04886eb07683c4_adrian-154478-unsplash-300x240.jpeg)
Location services are one of the most valuable features you can leverage in an app. A 2016 Pew Research Center report said that 90% of smartphone users keep Location Services on at all times. And digital analysts at eMarketer predicted that number would jump to 96% just that year.
Trying to build a team of testers in every location where users might interact with your app is both time-intensive and costly. To combat that cost, at PLUS QA we mock (or “spoof”) locations to test apps for clients who utilize location services. Using one of the 260+ devices in our office, we can test as if we’re shopping at Walmart in Des Moines or as if we’re a parent hurriedly searching for the nearest emergency room in LA.
Here’s how to test location services:
Testing for Mock Locations
So, how exactly do our Portland-based testers pretend to be an Iowa-based shopper or concerned parent in Southern California? That depends on the app.
Mocking Locations on iOS
You can simulate locations for iOS by using Interface Builder or by using Xcode.
In Xcode, start by setting up a provisioning profile to code sign the app. You can do this by adding an account in Xcode’s Preferences and signing in with an Apple ID and password.
![XCode Screenshot](https://cdn.prod.website-files.com/660a4cd9206686f4fc7ccf44/660a4de65f04886eb07683d0_xcodemocklocation1.png)
Then, create a new project, select “Single View App”, and select a location by adding the latitude and longitude of your desired location.
![Xcode Screenshot](https://cdn.prod.website-files.com/660a4cd9206686f4fc7ccf44/660a4de65f04886eb07683cc_xcodemocklocation2.png)
Finally, select your desired location at the bottom of Xcode — and start testing!
![Xcode Screenshot](https://cdn.prod.website-files.com/660a4cd9206686f4fc7ccf44/660a4de75f04886eb07683de_xcodemocklocation3.png)
Mocking Locations on Android
Android has similarly prepared for testing apps from different locations with “Mock Mode”. By putting Location Services into mock mode, you can test every part of your location-specific code with ease.
To turn on Mock Mode, request the permission android.Manifest.permission#ACCESS_MOCK_LOCATION, enable mock locations on your test device, and turn on mock mode in Location Services.
Once Mock Mode is turned on, you can create mock locations by creating a new location object using test data.
![Android Mock Mode Screenshot](https://cdn.prod.website-files.com/660a4cd9206686f4fc7ccf44/660a4de65f04886eb07683c9_screen-shot-2018-09-13-at-5.24.21-pm.png)
You can find more detailed instructions in Android’s Developer Console. You can also use Android’s mock location provider app, or a third-party option that supports the same purpose, such as these two well-reviewed Fake GPS Location Android apps.
Mocking Locations on the Web
![Person sitting with hands on the keys of a laptop](https://cdn.prod.website-files.com/660a4cd9206686f4fc7ccf44/660a4de65f04886eb07683c0_christin-hume-505826-unsplash-300x200.jpeg)
Websites can be tested for myriad locations with a simple (and safe) VPN solution. A VPN (or Virtual Private Network) shields activity — such as your current, actual location — from your Internet Service Provider and allows data to be sent and received without tracking activity.
After installing the VPN solution of your choice (there are several good options here), simply change your location within the network to test your site in varying places.
* * *
By developing and testing apps for different locations, you not only enhance your user experience . . . you expand your user base! Besides actually traveling to all of the different locations in the world, what could be better than that?
Does your app leverage location-based services? Connect with PLUS QA to learn how to test location services — and more!