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 need to convert the mobile strings in the test script into the localized strings of the application. With IBM® Rational® Test Workbench, you can run a recorded test in the default language of a mobile device by using different localized strings.
Note: The application must be localized to be able to take advantage of this feature of Rational Test Workbench.
You need access to the following software, applications, and test:
- Rational Test Workbench 184.108.40.206: Installed and configured with the Rational Test mobile client installed on a virtual machine or mobile device.
- A mobile application that contains translation strings: To be able to convert the standard strings in the test script into localized strings, verify that the application under test contains translation strings.
- A created and recorded test that is to be replaced by localized strings: You can convert all the mobile strings into localized strings in the tests at one time, or convert them one by one.
- Android (versions 2.2 to 4.4): Download the latest SDK.
General process to convert strings in a test script
By using the Rational Test Workbench you can create test scripts by recording user actions on a mobile application. If the locale of the mobile application changes, however, the recorded scripts are of no use. In this situation, you need to change locales in the test scripts and then run the scripts on a mobile application that has a different locale.
Before you get started
Prepare to follow the steps in this article by performing the following tasks.
- Back up the Rational Test Workbench environment using a proven method before you make any file changes.
- Test your changes in a development environment before you roll them out to a production environment.
- Determine whether your localized language is supported in Rational
Test Workbench 8.5.1. Check the following list:
- ar- Arabic
- bg- Bulgarian
- ca- Catalan
- cs- Czech
- da- Danish
- de- German
- el- Greek
- es- Spanish
- fa- Persian
- fi- Finnish
- fr- French
- hu- Hungarian
- nl- Dutch
- pl- Polish
- pt- Portuguese
- ro- Romanian
- ru- Russian
- sk- Slovak
- sl- Slovenian
- sr- Serbian
- sv- Swedish
- th- Thai
- tr- Turkish
- uk- Ukrainian
- vi- Vietnamese
Note: This list is not exhaustive. To see a detailed list of all of the available, supported locales, open a test and go to Test Element Details as shown in Figure 1. Click the drop-down arrow in the field next to Used local for localized strings to see the complete list.
Figure 1. List of supported locales
Verify that the application has been localized
The following steps apply to Android and iOS applications under test. The phrase mobile strings means the graphic objects, such as the buttons or objects that are identified by text strings in the test script recording. You can convert all the mobile strings into localized strings in your tests at one time, or you can convert them one by one.
- In the mobile application node of the Test Navigator view, double-click your application file or click the display available mobile applications icon on the toolbar. In the Mobile Applications editor that opens, select an application from the list.
- In the right pane of the editor, click the Localized Strings tab. As shown in Figure 2, a table displays the translation keys that are found in the application for the mobile strings.
- Click the Locale column heading to see the languages
handled by the application. You can apply filters to sort the data
items in the table. By default, the filter applies to the key, 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 to filter the keys
- Filter using key to filter the strings
- Filter using locale to filter the locales
- Check that you find the appropriate translated strings in the target language of the mobile device that will be used to run the test.
Figure 2. Localized strings
Convert the full set of mobilestrings into localized strings
To convert the full set of mobile strings in your test script into localized strings of the application, follow these steps:
- In the Test Navigator view, double-click your test file or right-click and click the Test editor to edit the test.
- In the test script, right-click on the root node and click Convert mobile strings into localized strings. As shown in Figure 3, the Localize mobile strings in test wizard opens.
Figure 3. Localized mobile strings in test
- Click 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
Note: For iOS devices, you can have device-specific locales in the list. For example, you might record a test on a device set to English locale (
En). Check for other options. If you record a test on an iPhone, use the locale
en_iPhone. If you record a test on an iPad, use the locale
- 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 need to select a key.
- In the next cell, click Select key and choose the appropriate key in the list. Click Finish.
As shown in Figure 4, 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.
Figure 4. Localized test contents
Convert a single mobile string into a localized string
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 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 the Text edit in the right pane, then choose Convert string to localized string. 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.
Convert localized strings into standard strings
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 need to convert the mobile strings into standard strings in the test script.
- In the test, click the mobile app element that represents the mobile app that contains a localized string. In the right pane, right-click the Text field. A list that contains multiple choices for the selected string is displayed, as shown in Figure 5. You can filter the list.
- Double-click 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.
Figure 5. Localized strings settings
- Save and replay your test. You can run the test in different language environments.
- In the test report, you can see that the object names and the text are displayed in the new target language.
This article explains how you can run existing test scripts on mobile applications that are not in English but in some other locale. It describes how to localize test scripts by using Rational Test Workbench. This process saves you the effort of re-creating test scripts for different locales.
- Find Rational Test Workbench articles and links to many other resources on IBM developerWorks and check the product overview page.
- Find Rational Team Concert articles and links to many other resources on IBM developerWorks, and check the product overview page, features and benefits, system requirements, and the user information center.
- Explore the Rational software area on developerWorks for technical resources, best practices, and information about Rational collaborative and integrated solutions for software and systems delivery.
- Stay current with developerWorks technical events and webcasts focused on a variety of IBM products and IT industry topics.
- Improve your skills. Check the Rational training and certification catalog, which includes many types of courses on a wide range of topics. You can take some of them anywhere, anytime, and many of the Getting Started ones are free.
Get products and technologies
- Download Rational Test Workbench, which includes Rational Integration Tester, from Passport Advantage.
- Download a free trial version of Rational software.
- Evaluate other IBM software in the way that suits you best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.
- Get connected with your peers and keep up on the latest information in the Rational community.
- Ask and answer questions and increase your expertise when you get involved in the Rational forums, cafés, and wikis.
- Rate or review Rational software. It's quick and easy.
- Share your knowledge and help others who use Rational software by writing a developerWorks article. Find out what makes a good developerWorks article and how to proceed.
- Follow Rational software on Facebook, Twitter (@ibmrational), and YouTube, and add your comments and requests.
Dig deeper into Rational software on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Experiment with new directions in software development.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.