iOS/Android using Java: Appium test automation for localization/globalization questions

Hello,

I need use Appium to automate my localization/globalization test, that is, I need run tests on the app which is translated to multiple languages, on iOS and Android platforms using Java. I don’t have product source code and apple dev account.
My scenario is:

  1. launch English app on simulator or emulator or device
  2. run all my localization test and take screenshots as needed while executing the test, save them to a named folder like ENU
  3. after the test is completed on English, change the system language to German(Android: need use a 3rd party app to switch the language I need. iOS: need use system settings to switch the language)
  4. launch the app and rerun all my test, take screenshots as needed while executing the test, save them to a named folder like DEU
  5. Repeat the test for all my 30+ languages

My question:
Could you please confirm if I can use Appium to automate my scenario on Android/iOS platforms, especially for the system language switching using 3rd app or iOS system settings? simulator/emulator or real device don’t matter now.

I only work with Android, so I will address how you can test in other languages

apktool will allow you to unpack the apk and get access to the strings.xml file for each supported language:

apktool d -f <my_package.apk>

This will create a directory called “my_package”, and you can find the English Language file under res/values/strings.xml

You will then need to parse this file (I use a modified version of nokogiri to do this) to create a hash/dictionary of symbols to strings. You will find the other language files under this directory and can parse the strings.xml file in there the same way. The symbols representing the strings will be the same. Beware of the following two issues:

  • Some strings have multiple forms, none, singular, plural
  • Some characters are escaped with a backslash and you will need to massage them to compare to the text visible on the screen

When changing languages on android, you can bring up the language settings by starting settings with the right parameters (see the android manifest file for Settings), but that requires an adb command unless you can coax Appium to start the app for you. I believe you can do that now, but you couldn’t when we started developing.

Your problem when using that app is there are no resource ids, so to press the “select language” button, you need to know all forms of that string in the languages you will be testing. A little experimentation will reveal the answers, but, alas, you must hard code these. Selecting the languages will be easier since the language is represented in it’s native form. Again, you will likely have to hard code these.

Now, you can compare the text fields on each screen of your app with the expected values obtained from the language files.

2 Likes

@willosser Thank you so much for detail instruction and experience sharing!

Actually, I spent some time to use a simple demo to prove that Appium can satisfy my current need of UI automation on Android and iOS.
Android is easier.
iOS, we must have a debug build signed with developer certificate, otherwise Appium can install successfully neither on simulator nor device.
In my case, the product dev team can’t support me to produce such a build for me, so I have to download all the code to my test machine, and build using Xcode, sign it with my developer certificate.
Finally I can install the .app on my device and run the test.