How do I test location based application?

Can you suggest what are the best tools or approach to test the location based mobile application.

Location based means real time tracking like Uber app. In practical scenario its need to check in field with multiple users so its very time consuming and lots of effort required.

So is there is any way we can test all scenarios by sitting at one place and test?

1 Like

Hi, in case the app is based on web technology then you could test it with Playwright.
Playwright has a nice API for emulating a geolocation:

In case it’s a native app, maybe Appium? It seems to support setting the geolocation as well.
https://appium.io/docs/en/commands/session/geolocation/set-geolocation/

1 Like

I once had to test an navigation based feature.
Every now and then we had to drive around.

Sure, you do not do this every time, but it does not hurts to do it every now and then.

How about asking you developers what they can mock or simulate?
If it’s an mobile app: Maybe an emulator can make you simulate that.

Hey @yagi,

Great question there. Similarly in the passed we used a bit of geolocation and driving around at the time to confirm. However I suspect you may want to explore this possibly with something like BrowserStacks Geolocation. I’ve not used there but might be a start. Geolocation testing using App Live | BrowserStack Docs. or Simulate IP geolocation for Selenium tests | BrowserStack Docs

Let us know how it goes!

Also wanted to mention besides mock geolocation from the test tools, if not offered or not good enough, can also look into 3rd party mock geolocation apps that you can install on test device and use it in combination with the test automation, you might be able to control the mock geolocation app with the test automation too, but not sure, probably easier to do this on Android than iOS.

For testing real location in a more controlled/automated way, this might be easier when testing small scale (and higher accuracy) “indoor” location applications/deployments. This of course is a very niche area and require special network/hardware deployment for the application to detect bluetooth beacons via Bluetooth Low Energy (BLE) technology. If you were testing this type of application, you could rig up a hardware test setup that moves in a fixed or random path and test against that path movement. For example:

  • a toy train railroad track, with mobile device attached to the train for it to move along the track
  • a conveyor belt setup, with mobile device moving along conveyor belt (if not in a loop, then back & forth along the conveyor belt)
  • attaching the mobile device to a Roomba or equivalent robot vacuum device, etc. to move about a room, etc.

In all these example setups, the BLE beacon hardware is placed along various points of the path the device will travel through, so that the application under test can detect and figure out it’s estimated location. You however would need to figure out how to validate the application’s estimated location vs the actual location of the device at given points in time, to determine the accuracy and functionality of the application.

For an example application for indoor locations, see https://play.google.com/store/apps/details?id=com.mist.mist_experience.

For the larger scale, less accuracy outdoor location version, to have a controlled/automated test equivalent, you’d probably need something like the self driving car setup, programmed for some fixed route, if not using random route testing, and run your test automation against a mobile device in the car. If not self driving car, can drive the car manually or walk/bike with the mobile device tagging along for the route/movement, you can then run test automation against that if not doing the testing manually.

The larger scale outdoor location testing, could also be tested indoors (or outdoors) if you have a decently sized test setup for something like a railroad track or conveyor belt, but it would need to be pretty big/long to test a decent GPS location route, like probably a quarter mile or 800 ft, etc.

FYI, I mention less accuracy for GPS outdoor location, in the sense that with outdoor location covering a wider scale, being several meters off in actual location, you won’t really notice any difference for where you are on the map or road/street, it’s “close enough”, and easy for the application to account for. With indoor location, being a meter or more off, you really see the difference on the map/screen, so it gets harder to fudge/patch the inaccuracies for a smoother look as you move around the map.

@yagi I believe, by far the easiest way to do it is to use testrigor.com with its geolocation setting feature. Here is the doc: testRigor Language Support Documentation - testRigor AI-Based Automated Testing Tool and here is an example app test: How to Automate Search Stores Near Me Testing - testRigor AI-Based Automated Testing Tool and somebody created an open-source example here: testRigor - testing from end-user's perspective Disclaimer: I’m a testRigor co-founder