Reputation: 198
I am integrating my application with some country-detection module. Overall logic is:
That works very well, but I am having problems writing automated integration tests.
There is a way to override (force) certain test IPs, but the problem is that all IPs are periodically changing, and time to time I am getting my tests failed because of that.
Any ideas how to stabilize such tests? One thought I had is if there was a directory of main ISPs across the world, but could not find it.
Thanks!
Upvotes: 1
Views: 1476
Reputation: 1052
Also, you can use the CSV file of IPs that MaxMind use for their unit tests (see https://stackoverflow.com/a/23616234/354709)
Upvotes: 0
Reputation: 26
You can override the GeoIP lookup service in your test environment to return fixed values for certain test IPs. But this only tests #4. To test #1,2,3, you need to use real IP addresses.
If your needs are limited to only a few countries, you can purchase private proxies with fixed IPs and run your tests through a proxied client with a fixed IP.
To automate at scale, you can look at https://www.geoscreenshot.com, it provides an API for visually testing many locations simultaneously.
Upvotes: 1
Reputation: 1457
You might need to use VPN to test applications. Some providers offer free servers in fixed countries.
If it is a web application, you can use http://www.locabrowser.com to test page view from different servers in multiple countries.
Upvotes: 1