To test how your application behaves for visitors in another country or region, run your cloud tests through a mabl Link tunnel whose Link Agent runs in that region. Your application then sees test traffic arriving from the region's network, so you can check region-specific content, pricing, redirects, and access rules.
This article explains how to…
- Set up a Link tunnel for each region
- Run tests from a region with one environment per region
- Run tests from a region with a deployment event override
How regional testing works
When a test runs over mabl Link, the browser still runs in the mabl cloud, but the Link Agent makes the connections to your application. Those connections leave from the network where the Link Agent runs, and DNS names are resolved there too. To your application, CDN, or firewall, a test that uses a Link Agent in Toronto looks like a visitor in Toronto.
Because the region is decided by where you run the Link Agent, you can test from any region where you can run a server, VM, or container. You don't need mabl to run tests in that region or to allowlist new mabl IP addresses for it. Test traffic over mabl Link comes from your own Link Agent hosts, not from mabl's static IP addresses.
What doesn't change
mabl Link changes where your application's traffic comes from. It doesn't move the rest of the test:
- The browser, test results, and run artifacts stay in the mabl cloud, the same as any other cloud run.
- The browser's geolocation API still reports the location of the data center where the browser runs. If your application reads the browser's location rather than the visitor's IP address, see Working with popups.
- The browser's locale and timezone stay at the cloud defaults. To match the region's language, currency, and date formats, also set the browser locale and timezone on the plan.
- Mobile tests send only API steps, JavaScript snippets, and database queries through mabl Link. See the limitation in Secure tunneling with mabl Link.
Set up a Link tunnel for each region
Give each region its own tunnel, with a name that identifies the region, such as acme-ca for Canada and acme-uk for the United Kingdom. Tunnel names use lowercase letters, numbers, and dashes, up to 24 characters.
- Create a Link Agent API key. To use the regional tunnels from every workspace in your company, create a company key and make them company-scoped tunnels. Otherwise, create a workspace key. See Link Agent setup.
- In each region, provision a host that meets the Link Agent requirements, such as a VM in a cloud provider's Canada or UK region.
- Install the Link Agent on the host and start it with the region's tunnel name. See Link Agent setup.
- On Linux and macOS hosts, accept the installer's offer to raise the socket-buffer limits. A Link Agent far from the mabl cloud moves data much faster with the higher limits. See Raise the host's socket-buffer limits.
- Confirm that each agent shows Connected on Settings > Networking, or on the Networking page of the company dashboard for a company tunnel.
One or two Link Agents per region are enough for most teams. A second agent with the same tunnel name keeps the region available while you update or restart the first one, and adds capacity. For how much CPU and memory each host needs, see Sizing and scaling Link Agents.
Check where the agent's traffic leaves
Your application sees the public IP address that the Link Agent's traffic leaves from. If the host sends outgoing traffic through a corporate proxy, NAT gateway, or VPN in a different region, your application sees that region instead. To check the location, open a test that loads an IP lookup page in a training session over the tunnel.
Run tests from a region
There are two ways to choose the region for a run. Use separate environments when you test each region on a regular schedule, and a deployment event override when a CI/CD pipeline decides the region for each run.
Use one region's tunnel per run
If an environment or override lists more than one tunnel, mabl sends each connection through one of them and tries another if the first can't reach the destination. A run that lists acme-ca and acme-uk together can send some of its traffic from each region. Give each run the tunnel for a single region.
Run tests with one environment per region
Create an environment for each region and point it at that region's tunnel. Every plan and test run in the environment then sends its traffic from the region.
- Go to the environments page: Configuration > Environments.
- Click + Add environment and give it a name that includes the region, such as "Production - Canada".
- Check the Use link agent box.
- Select the region's tunnel, such as
acme-ca, from the mabl Link agent list. - Save your settings.
- Repeat for each region.
- Add the regional environments to your plans. A plan runs every test once for each of its environments, so one plan that includes "Production - Canada" and "Production - UK" tests from both regions on every run. See Plans.
For more about environment settings, see Authoring and running tests over mabl Link and Configuring applications and environments.
Run tests with a deployment event override
To choose the region when you trigger the run, keep one environment and override its tunnels in a deployment event. Add link_agent_labels to plan_overrides in the request body:
curl -s "https://api.mabl.com/events/deployment" \
-u "key:{api-key}" \
-H "Content-Type:application/json" \
-d '{
"environment_id": "{environment-id}",
"plan_overrides": {"link_agent_labels": ["acme-uk"]}
}'
Every plan the deployment event triggers sends its traffic through the acme-uk tunnel, in place of the tunnels configured on the environment. To test several regions from the same pipeline, trigger one deployment event per region. See Overriding the Link agent name in a deployment event and API-based CI/CD integrations.