Running a test with different localized strings

When you record a test on a mobile device, the test is always generated in the default language of the application. However, it is possible that the language defined for the device running the test is different from the default language of the application. This language difference between the mobile device and the application means that to replay the test on the mobile device, you must convert the mobile strings in your test script into the localized strings of the application. You can do this only if the application has been localized.

Before you begin

You must have created and recorded a test. To be able to convert the standard strings in your test script into localized strings, you must verify first that the application under test contains translation strings.

About this task

This task applies to Android and iOS applications under test.

The words mobile strings define the name of graphic objects such as buttons or objects identified by texts in the test script recording. Note that you can convert all the mobile strings into localized strings in your tests at one time, or convert them one by one.

Procedure

  1. Verify that the application has been localized:
    1. In the mobile application node of the Test Navigator view, double-click your application file or click the display available mobile applications icon Display available mobile applications on the toolbar. In the Mobile Applications editor that opens, select an application from the list.
    2. In the right pane of the editor, click on the Localized Strings tab. A table displays the translation keys that are found in the application for the mobile strings.
    3. Click on the Locale column heading to see the languages handled by the application. You can apply filters to sort the data items in the table. The filter applies to the key by default but you can filter strings or locales. To do so, enter a value in the filter field and click one of the following icons: Filter using key Filter using key to filter the keys, Filter using keyFilter using key to filter the strings, Filter using locale Filter using locale to filter the locales.
    4. Check that you find the appropriate translated strings in the target language of the mobile device that will be used to run the test.Localized strings table tab
  2. Choose how you want to convert the mobile strings in your test script into localized strings of the application.
    • Convert the full set of mobile strings:
      • In the Test Navigator view, double-click on your test file or right-click and click on Test editor to edit the test.
      • In the test script, right-click on the root node and click on Convert mobile strings into localized strings. The Localize mobile strings in test wizard opens:
        Wizard Localize mobile strings in test
      • Click on the Locale column heading in the table and select the correct locale for the translation of the strings. This must be the local string used on the device during the test recording.
        Note: You can have device specific Locales in the list, for iOS devices. For example, if you recorded a test on a device set to English Locale, there could be other choices of locales other than just En for English: en_iPhone (this should be selected if recording was done on iPhone) and en_iPad (this should be selected if the recording was done on iPad).
        As a result, the table displays the translated strings available in the application. The rows containing translated strings are checked. If several keys are available for a string, you must select a key.
      • In the next cell, click select key and choose the appropriate key in the list. Click Finish.
      • Now, in the test script, you can see that the localized strings are underlined. If you click on a localized string in the test script that corresponds to a graphic object identified by text, you can see in the right pane that the Text field contains multiple choices for the current string. The mobile strings have been converted to localized strings. They are underlined in the test script.
    • Convert a single mobile string in your test script into a localized string of the application:
      • In the test script, select the launch application node. In the right pane, click Used locale for localized strings and select a language the local string used to record the test script. If your test contains instances of other applications or several nodes, click the Apply selected locale to icon Apply selected locale to and select one of the choices Apply locale to the same application node or Apply locale to all application nodes.
      • Select the node containing the mobile strings converted to localized strings and right-click on the text edit in the right pane, then choose "Convert string to localized string". In the test script, now you can see that the localized strings are underlined. If you click on a localized string in the test script that corresponds to a graphic object identified by text, you can see in the right pane that the Text field contains multiple choices for the current string.
  3. Convert the localized strings in your test into standard strings. If you want to have the localized strings or the localization keys as standard values in your test script, you must convert the mobile strings into standard strings in the test script.
    1. Click a mobile element in the test containing a localized string. In the right pane, right-click on the Text field. A list containing multiple choices for the selected string is displayed. You can filter the list.
    2. Double-click on the string of your choice in the list and click Convert into standard string using localized string as value to have the selected localized string in the test or Convert into standard string using localization key as value to have the associated key in the test.
      The list displays the multiple choices available for the localized string selected in the test.
  4. Save and replay your test. You can run the test in different language environments.
  5. In the test report, you can see that the object names and the text are displayed in the new target language.

Feedback