Language dependent / localized testing


#1

Ever had to test some region/language dependent websites? Testing your websites while coming from a different geographic location is very important. This kind of testing can also be tricky while working with proxy servers is required.

Ranorex Webtestit offers you the possibility to easily set up those proxy servers, as well as to access some endpoint specific info’s from within the test (browser name, headless execution state, etc.) to make your tests cleaner and more intuitive.

Here is a short example of localized website testing using different proxy servers, and accessing endpoint information:

In this example, we will use the download free trial form from www.ranorex.com/free-trial, where the location of the user coming to this form is automatically detected.

We will access the website using proxy servers from Germany with Opera browser and US proxy server with Google Chrome browser.

Step 1. Set up proxy servers on your endpoints:

If you don’t have some dedicated proxy servers on your own for testing purposes, here are some websites where you can get a free proxy:

Note: Listed above are some websites that contain a list of proxy servers free to use. Make sure your selected server is actually working before proceeding to create your automated test with Ranorex Webtestit.

Select an endpoint and set up your proxy server in the desired capabilities dialog box in this format:

{
  "proxy": {
"proxyType": "MANUAL",
"httpProxy": "proxyAdress:port",
"httpsProxy": "proxyAdress:port",
"ftpProxy": "proxyAdress:port",
"sslProxy": "proxyAdress:port"
           }
   }

For further information about setting up proxy servers in Ranorex Webtestit check out this article.
Now you should be able to see the different results when coming from different locations to the webpage. Use Assertions to confirm that the location is correctly detected.

In this test, we will access the website from different locations using the proxy server we previously set up:

  • In the Page Object file, we created the getCountryName() method

  • In the Test file, we are using that information and asserting the actual detected country name

Step 2. – Access endpoint information

In order to do this, we have to create a helper.java file, and some methods that will help us get the endpoint information. For a more detailed explanation on how to create the helper.java class please check out this article.
We will use the browserName() & isBehindProxy()methods informations to create some conditional test behaviour.
For example, if you use Google Chrome to access the website using UK proxy server, we will execute some steps specific to that case.
We created the helper.Java file and in it two methods:

  • isBehindProxy() checks if an endpoint is using a proxy server and returns a Boolean

  • browserName() as the name itself says, returns a string with the name of an endpoint in use.

With this info’s we can make some specific test steps depending on the browser you are using or the proxy server in use. In the example below, we will create some conditional test steps that depend on the endpoint specific information and proxy servers in use.

  • We are checking for the proxy server status and for the browser name. Depending on the outcome, we can create some conditional steps.

Conclusion:
In this article, you learned how to do localized testing, how to set up and use proxy servers on endpoints, as well as how to access some endpoints information from within the tests and use them to make conditional test steps.