Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Jubula » Testing GUI in different languages - HowTo
Testing GUI in different languages - HowTo [message #1793172] Tue, 31 July 2018 21:55
Milos Hroudny is currently offline Milos HroudnyFriend
Messages: 24
Registered: June 2017
Junior Member
Support of multilingual GUI testing was dropped since Jubula 8.2. However, our customer demanded testing of different language versions. This article can help some other Jubula users who are missing this feature in the current Jubula version. The suggested solution allows testing of the application in different languages without test modification.
We will use external variables stored in an Excel file. Let's say that the name of the project is <JPT>.
Testing rules to support multilingual applications:
- In the tests, work with variables and not directly with specific values
- Set variables at the beginning of the test
- Use Excel file as the data source to set variables
For Java applications it can be necessary set the "display language" on the test machine:
Control Panel→Region and Language→[Keyboards and Languages]→Choose a display language
Activation of this setting requires restart of the computer. This is also one of reasons why the suggested solution allows testing only one language in one run.
To test HTML application, the special "display language" does not need to be set.
The advantage of storing data in an Excel file is that the test need not be modified in any way to test different languages. Each language needs its own Excel file. This file must meet certain conditions:
• The name and location of the Excel file is fixed in the project firmly in the <SetVariablesCentral> module configuration. It is not possible to use parameters to configure the Excel file location. The file directory must have write permission. We suggest using the d:\temp\<JPT> as the directory for Excel files.
• Jubula supports only "xls" files that are compatible with Windows Excel 97-2003.
• Excel files must already exist in the selected directory at the time we develop and run the tests. In the directory d:\temp\<JPT>, we can store any version of the file. It does not matter which language version will be tested. Only the presence of the file configured in the <SetVariablesCentral> configuration is important. In the directory will be stored the JPTvarsLanguageDE.xls, JPTvarsLanguageEN.xls files and the like. At the start of the test, we will overwrite the JPTvars.xls file used for loading variables by the file of the tested language, e.g. JPTvarsLanguageEN.xls. This change is only possible once at the start of the test, but that is enough. We fulfilled the condition that the file existed at the start of the test, and that the file was loaded only once. Once the file is loaded, the next attempt of change has no impact. That means that during one test run we can test just one language version.
To create variables for multilingual support, we use the following definition of variables:

We define variables in Jubula by using the <ub_app_storeValue> module of the library unbound_modules_concrete_[8.5].The module can be found on the path Actions→Store→Application of the named library. At first we create the <StoreValue> user defined module created by simple application of the <ub_app_storeValue> module. Parameters of the <ub_app_storeValue> module reference are configured
Once we have this module, we create the module <SetVariablesCentral>. This module will apply the <StoreValue> module. Parameters of the <StoreValue> module reference are configured

When configuring the <SetVariablesCentral> module, set Properties→Test data:
Data Source = Local Test Case
Excel Data File = d:\temp\JPT\<xlsFileName>
As the <xlsFileName> I suggest using of the '<applicationShortName>vars.xls'. If the short name of the application is JPT, the file name would be JPTvars.xls.
The test on the test machine works with variables defined in the Excel file and their values are compared to the language specific UI texts. The Excel file contains KEY-VALUE pairs, where KEY is the name of the variable and VALUE is its value in a specific language. The word "KEY" must be in the cell A1, and the word "VALUE" in the cell B1 of the Excel Sheet1. In the following rows are defined variables. In the first column the name of the variable, in the second column its value. The <SetVariablesCentral> module that wraps the <StoreValue> module is responsible for loading variables. For each Excel row, <StoreValue> executes once and defines one variable. For the first time or in case that the content of the file is extended, copy the JPTvars.xls file into the d:\temp\JPT directory manually. When you change the language, e.g. in the language.txt configuration, the file JPTvarsLanguageEN.xls or JPTvarsLanguageDE.xls can be copied using test module.
The Excel file may contain also other variables related to the language. For example, this might be the "PathIcons" variable that specifies the path to the icons directory for the specific language. Images may be different for different language versions, and the abbreviation of the language name is used to switch to the correct directory.
Previous Topic:Test an Eclipse RCP application having JavaFX views
Next Topic:Static functions in Jubula - HowTo
Goto Forum:

Current Time: Sat Dec 02 09:08:47 GMT 2023

Powered by FUDForum. Page generated in 0.01907 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top