Test an app from a specific location
Run your app on a real device whose traffic comes from a country or region you name, and check geo-blocking, local currency, and translated screens.
Some app behavior only appears when the request comes from a particular country: a catalog section that is hidden in one region, a price in local currency, a translated screen, a regional redirect. Testing from your own network does not show you any of it.
Name a country or region in your prompt. Test Companion starts the real-device session through BrowserStack IP Geolocation, so your app’s traffic leaves from that place.
IP Geolocation in Test Companion is available on request. Contact us to have it enabled for your account.
Prerequisites
- Test Companion version 1.23.0 or later on Visual Studio Code, or version 1.5.0 or later on a JetBrains IDE. Earlier versions of Test Companion do not offer geolocation.
- An app connected in App mode. See Connect your app.
- A backend reachable from the public internet. The device runs in the BrowserStack cloud and reaches your backend from there.
- The IP Geolocation add-on enabled on your BrowserStack account, to run the generated script yourself. You do not need the add-on to write the test, because Test Companion runs that session on BrowserStack’s own account.
IP Geolocation does not work with a backend on localhost or on your intranet. Test Companion reaches a local backend through a tunnel back to your own machine, so the backend sees requests from your own network rather than from the country you named. Point the app at a deployed environment first.
How it works
- You name a country or region in your prompt.
- Test Companion matches the name to a BrowserStack location code.
- Test Companion starts a real-device session that connects from that location.
- Test Companion installs your app, opens it, and works through the screens you named.
- When Test Companion writes the runnable script, it saves the location in your project’s configuration file.
Start a session from a location
Switch to App mode, connect your app, then name the country or region in your prompt.
Open the app from Germany and check whether the catalog prices are shown in euros.
You can also name a state or province. Test Companion uses that narrower location when BrowserStack supports one, instead of the whole country.
Test Companion resolves the name you give in one of three ways.
| Location name | Behavior |
|---|---|
| A supported country, state, or province | Test Companion starts the session from that location and names it in the chat. |
| A name that matches more than one place | Test Companion asks you to confirm the place before it starts the session. |
| A place BrowserStack does not support | Test Companion names the locations it does support, then retries with one of them. Your task continues. |
For every place you can name, see the list of countries and the list of states.
Confirm the location was applied
Test Companion names the location it used when the session starts. Read that line before you draw any conclusion from the app, because prices and copy mean nothing until you know where the request came from.
When Test Companion cannot apply the location, it says the session ran without it. It does not claim the session came from your chosen country. It does not attribute localized copy, currency, or a hidden section to the location.
The usual cause is that IP Geolocation is not enabled for your BrowserStack account yet.
Treat the message as a prompt to check your account, not as a test result.
Save the location in your test script
Test Companion adds the geoLocation capability to the configuration file your project already uses, so your own runs start from the same place. The location code is short: DE for Germany, DE-BY for Bavaria.
In browserstack.yml:
bstack:options:
geoLocation: DE
In wdio.conf.js or another Appium configuration:
'bstack:options': {
geoLocation: 'DE',
}
Review the change in the editor diff view before you accept it.
Known limitations
IP geolocation changes the address your app’s traffic appears to come from. It does not set the device’s GPS coordinates, so a nearby-places search or a map centered on the user still reports the device’s real location.
Use IP geolocation to test what your backend or a third-party service decides from the origin of the request. For anything the device reports about itself, it makes no difference.
Best practices
- Name the location in the prompt itself. Test Companion then starts the session without stopping to ask you.
- Read the reported location first. Prices, copy, and hidden sections only tell you something after you know where the request came from.
- Point the app at a deployed backend. A backend on your own machine or private network cannot be reached from the country you name.
Example prompts
Check what is available in a region and write the test for it:
Open the app from Germany and check whether the premium catalog section
is hidden. Then write an Appium test that asserts it.
Compare localized pricing across two countries:
Launch the app from the United States and then from Germany, and tell me
whether the subscription prices and currency differ.
Check behavior that varies by state:
Run the checkout flow from Bavaria and confirm the correct VAT rate
is applied.
Next steps
- Automate tests: Turn the flow you just ran into a script that runs on your own account.
- Test a website from a specific location: Run the same kind of session against a web application.
- IP Geolocation: Read how the capability works on BrowserStack and see every supported location.
- Prompt guide: Write prompts that produce better results.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!