App & Browser Testing Made Easy

Give your users a seamless experience by testing on 3000+ real devices and browsers. Don't compromise with emulators and simulators

Get Started free
Home Guide How to Perform Localization of Mobile Apps using Appium

How to Perform Localization of Mobile Apps using Appium

By Mohammad Waseem, Community Contributor -

Localization testing is the process of testing your website or app for linguistic or cultural relevance across different parts of the world. It allows you to customize the app or website  based on the region, targeted language, audience, and other geography-based regulations.

In this article, let us learn how to perform localization testing for mobile applications using Appium

What is Localization Testing?

Localization testing simply means creating test cases that clearly show how your mobile application will perform in specific regions and locales. For example – Testing if the mobile will perform with the same efficiency for people living in an Asian subcontinent as much as it would in a South American or European region. 

Let’s take a look at the various test cases that can be included in localization testing. 

Test Cases in Localization Testing 

  1. Localized user interface for the ease of access for the users in that specific region. 
  2. Testing if language, date, time, currency, and similar features are aligned properly with respect to the specific region or locale. 
  3. The application adheres to the region-specific terms of usage, rules, regulations, etc. 
  4. The popup message, dialog boxes, and validation texts for the input fields are all region specific. 

Let’s take a look at a simple example of how one can perform localization testing using Appium for any mobile application. 

Performing Localization Testing Using Appium 

In this test, let us set the language of the app under test to Espanol aka Spanish, and the locale to Spain. At the same time, declare the same in the desired capabilities as well. Using the app_strings command from the Appium, let us retrieve the app’s localized strings for the particular language. 

You can upload the sample application by using the following code: 

import requests

files = {
'file': open(r'WikipediaSample.apk', 'rb'),
}

response = requests.post('https://api-cloud.browserstack.com/app-automate/upload',
files=files,
auth=("your username"))

print(response.content)



Enter App URL

You must use the app_url generated from the above script in your desired capabilities. 

The following test case will check whether the application is localized for the Spanish locale in the Spanish Language.

[python]

from appium import webdriver

from appium.webdriver.common.mobileby import MobileBy

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.support import expected_conditions as EC

import time

desired_cap = {

    # Set your access credentials

    "browserstack.user": "your username",

    "browserstack.key": "your key",

    # Set URL of the application under test

    "app": "<appurl from the API call>",


    # Specify device and os_version for testing

    "device": "Google Pixel 3",

    "os_version": "9.0",


    # Set other BrowserStack capabilities

    "project": "Localization Testing",

    "build": "browserstack-build-1",

    "name": "first_test",


    # set the language capabilities

    "language": "es",

    "locale": "ES"

}


# Initialize the remote Webdriver using BrowserStack remote URL

# and desired capabilities defined above

driver = webdriver.Remote(

    command_executor="http://hub-cloud.browserstack.com/wd/hub",

    desired_capabilities=desired_cap

)


appStrings = driver.app_strings(

    "<es>"

)

# Test case for the BrowserStack sample Android app.

# Below test case is for sample Wikipedia app. If you have uploaded your app, update the test case below.

search_element = WebDriverWait(driver, 30).until(

    EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Buscar en Wikipedia"))

)

search_element.click()

search_input = WebDriverWait(driver, 30).until(

    EC.element_to_be_clickable(

        (MobileBy.ID, "org.wikipedia.alpha:id/search_src_text"))

)

search_input.send_keys("BrowserStack")

time.sleep(5)

search_results = driver.find_elements(MobileBy.CLASS_NAME, "android.widget.TextView")

assert (len(search_results) > 0)


# Invoke driver.quit() after the test is done to indicate that the test is completed.

driver.quit()


[/python]

The test runs successfully and the application can retrieve the strings file and find the localized element. 

TestExecution

Localization testing not only ensures a seamless delivery of the application in various regions and locales, but it also capitalizes on the scalability of the product/application by ensuring global reach and accessibility. 

You can seamlessly perform Localization testing with Appium on different devices using BrowserStack. BrowserStack offers instant access to a pool of 3000+ devices, browsers, and operating systems. By performing localization testing using BrowserStack, QAs can test if the software works as intended across different parts of the country, or world. 

Perform Localization Testing for free on BrowserStack

Tags
Appium Local Testing

Featured Articles

How to Run Your First Appium Test Script

How to Automate Localization Testing using Cypress

App & Browser Testing Made Easy

Seamlessly test across 20,000+ real devices with BrowserStack