2017 October Release

How to Internationalize TestsPermanent link for this heading

This article describes how you can create tests that can be translated to multiple languages. This contains the following topics:

  • How to create language files that are used for translating a test
  • How you can use these language files to externalize the strings of a test
  • How tests with language keys can be translated to a specific language (resolved)
  • How language files can be used when running tests in the Fabasoft app.test Player
  • How to translate a test during recording it in the Fabasoft app.test Click-Recorder

How to Create Language FilesPermanent link for this heading

For translating tests language files (*.lang) are used. These are located in the standard folder "Resources" within a Fabasoft app.test project.

Create and Edit Language Files in the Fabasoft app.test StudioPermanent link for this heading

Language files in Fabasoft app.test are usually saved in the "Language Files" folder of a project which is located in the "Resources" folder. Per default the "Language Files" folder contains subfolders for English and for German language files. It is advised that language files for the same language are summarized in one folder.

You can create a new language file by opening the context menu of the folder, where the language file should be created, and clicking “New” -> "Language File".


After entering a name for the file and pressing the Return key, it is opened in the editor.

A language file simply consists of key/value pairs in text format. These can be entered into the grid that is displayed in the "Editor" view. Enter the name of the parameter into the Key field and the value (the language string) into the Value field.

By that way you can create language files for different languages (e.g. German and English). Please note that keys should have the same names in the different language files.

Source Code of Language FilesPermanent link for this heading

If you view the source of a language file (switch to the "Source" tab in the bottom of the "Editor Area" view), a key/value pair has the following Syntax

Syntax

key = "value"
   OR
key = value
   OR
key = 'value'

Example

ObjectList = "Object List"
Classic = "Classic"
Desk = "Desk"
Object = "Object"
New = "New"
More = "More"
WhatDoYouWant = "What do you want to create?"
WordObject = "Word Object"
Next = "Next"
EditProp = "Edit Properties"
ReadProp = "Read Properties"
Name = "Name"
Cancel = "Cancel"
Destroy = "Destroy"
Yes = "Yes"
YesToAll = "Yes to all"

Escaping in Language FilesPermanent link for this heading

Values in language files do not have to be escaped except wild card sequences like [*] or [?] appear in values. For escaping a character use a backslash.

Note: It is not necessary to escape quotes.

Example for Values:

"Object List" --> Object List
"Wild[*]Card String" --> "Wild[*]Card String" (wild cards are used)

"Special\[\?\] String" --> "Special[?] String" (no wild cards are used - the value is just a string)

"Another.[Special].String" --> "Another.[Special].String" (no wild cards, ".", "[" and "]" are interpreted as characters)

How to Translate a TestPermanent link for this heading

If you have recorded a test in a specific language (e.g. English), you can replace all language strings with the keys from a language file. Therefore, mark the test, ensure that the project explorer is focussed, open the menu “File” and select "Translate".

In the wizard that has opened you can select the language file(s) in the Language Files field by clicking the "+" button and selecting a language file. The selected language files are used in the defined order for resolving the test file.

In the Target File field you can select the file that should be created. Therefore, click the "Browse" button and select a test file (or enter a name) and click "Finish".

In the Save new values/unknown keys to field you can define a language file optionally where the keys and values that could not be specified should be saved. If you select an existing language file, you can decide that the file should not be overwritten but the new key/value pairs are added to the file. Therefore, select the Append new entries if file already exists check box.

Per default only the locations of executions and set statements are translated. But you can define additionally which properties should be translated, too.

  • For translating if-conditions, select the Translate "If" Properties check box.
  • For translating conditions in the ok attribute of executions and validations (e.g. when checking errors), select the Translate "Ok" Properties check box.
  • For translating entries in the Eval field of set statements, select the Translate "Eval" Properties check box.
  • For translating values in executions and set statements, select the Translate "Value" Properties check box.

If you have defined all necessary information, click "Next".

On the next wizard page it is displayed which keys are not set resp. which values are not represented in keys. For unresolved values a key name (which can be edited) is generated automatically. Select the check box of those keys that should be saved in the language file.

Click "Finish" to externalize the strings from the file (which means they are replaced by references to the keys in the language file).

The new test file is created with the references to the language keys from the language file(s). Existing keys stay untouched.

This is an example how the execution statements may look like after translating a file:

Before Translation

After Translation

<Execution action="Click"
   location="PAGES.Explore.Object List.MENUBAR.Object"/>
<Execution action="Click"
   location="MENU.New"/>
<Execution action="Click"
   location="PAGES.Explore.What do you want to create?.More"/>
<Execution action="Click"
   location="PAGES.Explore.What do you want to create?[0].Word Object"/>
<Execution action="Click"
   location="PAGES.Explore.BUTTONBAR.Next"/>
<Execution action="Set"
   location="PAGES.Explore.Name" value="MyWordObject"/>
<Execution action="Click"
   location="PAGES.Explore.BUTTONBAR.Next"/>

<Execution action="Click"
   location="PAGES.[$Explore].[$ObjectList].MENUBAR.[$Object]"/>
<Execution action="Click"
   location="MENU.[$New]"/>
<Execution action="Click"
   location="PAGES.[$Explore].[$WhatDoYouWant].[$More]"/>
<Execution action="Click"
   location="PAGES.[$Explore].[$WhatDoYouWant].[0].[$WordObject]"/>
<Execution action="Click"
   location="PAGES.[$Explore].BUTTONBAR.[$Next]"/>
<Execution action="Set"
   location="PAGES.[$Explore].[$Name]" value="MyWordObject"/>
<Execution action="Click"
   location="PAGES.[$Explore].BUTTONBAR.[$Next]"/>

The language files used for translating the file are referenced at the beginning of the file (which is displayed in the "Outline" view).

How to Resolve a Translated TestPermanent link for this heading

You can resolve a translated file again (which means the language keys are replaced by the language strings). Therefore, select the test, sequence or use case, which should be resolved, in the "Projects" view, open the "File" menu and select "Resolve Translation".

A wizard opens where you can select the language files as well as the target test file that should be created after translating the selected file.

Click "Finish" for translating the file.

Note: If a key could not be resolved its value can be edited on the second wizard page (by clicking "Next" instead if "Finish") and the unsresolved keys can be saved in a language file (which can be defined in the Save unresolved keys to field).

By that way you can for example resolve the file to German language (the file has been recorded in English and the strings have been replaced by references to language keys by externalizing strings).

Before Translation

After Translation (to German)

<Execution action="Click"
   location="PAGES.[$Explore].[$ObjectList].MENUBAR.[$Object]"/>
<Execution action="Click"
   location="MENU.[$New]"/>
<Execution action="Click"
   location="PAGES.[$Explore].[$WhatDoYouWant].[$More]"/>
<Execution action="Click"
   location="PAGES.[$Explore].[$WhatDoYouWant].[0].[$WordObject]"/>
<Execution action="Click"
   location="PAGES.[$Explore].BUTTONBAR.[$Next]"/>
<Execution action="Set"
   location="PAGES.[$Explore].[$Name]" value="MyWordObject"/>
<Execution action="Click"
   location="PAGES.[$Explore].BUTTONBAR.[$Next]"/>

<Execution action="Click"
   location="PAGES.Explore.Objektliste.MENUBAR.Objekt"/>
<Execution action="Click"
   location="MENU.Neu"/>
<Execution action="Click"
   location="PAGES.Explore.Was wollen Sie erzeugen.Weitere"/>
<Execution action="Click"
   location="PAGES.Explore.Was wollen Sie erzeugen.[0].Word-Objekt"/>
<Execution action="Click"
   location="PAGES.Explore.BUTTONBAR.Weiter"/>
<Execution action="Set"
   location="PAGES.Explore.Name" value="MyWordObject"/>
<Execution action="Click"
   location="PAGES.Explore.BUTTONBAR.Weiter"/>

How to Run Tests which Contain Language KeysPermanent link for this heading

You can also run tests in the Fabasoft app.test Player which contain language keys. Therefore, you can define the path where the language files are located when starting the Fabasoft app.test Player in the "Run" dialog. This path is needed because usually language files are referenced in test files by using the system parameter langpath. This system parameter is set to the value of the Language Files field of the "Run" dialog.

Note: You can reference language files within a test (analog to parameter tables) when starting the Fabasoft app.test Player. Therefore, you can add a language file to the test when it is opened in the Fabasoft app.test Studio by clicking the "Insert Language File" button in the "Outline" view (when the test is selected).

In the "Properties" view you can select a language file in the Filename field by clicking the "..." button.

When a file is executed that contains references to language files, the language keys in the file are resolved when running the test.

Following options are available:

  • replace (default)
    Adds all values from the language file to the translation table, but removes all existing values from keys existing in both the current translation table and the language file.
  • add
    Adds all values from the language file to the translation table of the test run. If a key already exists, all values are merged.
  • clear
    Clears the translation table of the test run. The filename attribute is optional. If specified, the language file is loaded after the table was cleared.

How to Translate Tests During RecordingPermanent link for this heading

If you use the Fabasoft app.test Click-Recorder for recording a test you can also translate your test (which means language strings are replaced by the references to language keys).

Therefore, you have to select the Translate check box in the Fabasoft app.test Preferences.

After starting the Fabasoft app.test Recorder you can reference language files in the "Outline" view. Therefore, select the test and click the "Insert Language File" button in the "Outline" view.

After inserting a file select the element in the "Outline" view and go to the "Properties" view. Here you can select a language file to be referenced by clicking the "..." button of the Filename field (see above).

You can load language keys into the Fabasoft app.test Recorder by selecting the translation statement (which means the reference to the language file) in the "Outline" view and clicking the "Step Into" button.

The language keys are loaded. All keys currently available are listed in the "Translation Table" tab in the "Editor Area" view.

If you now record statements in the Fabasoft app.test Click-Recorder, the language strings occuring in the location of an execution are replaced by the reference to the corresponding language key.

If a language string occurs that is not known (which means no language key exists for this string), the execution is recorded as usual. This means the language specific string(s) are not replaced in the location. If you want to save the values that have not been replaced during recording in a language file, you can translate (see chapter "How to Translate a Test”) the recorded test (and save the unknown values in a language file).

Note: In the Fabasoft app.test Click-Recorder the language strings are replaced automatically. If you record statements by using the control tree, you can select different locations (with or without replacing the language strings).

How to Import Language Files From a Fabasoft Folio DomainPermanent link for this heading

You can import all language strings from Fabasoft Folio into Fabasoft app.test (as language files).

Therefore, open the "File" menu and select "Import"

Select "Import Language Resources" and click "Next".

Now you have to enter the connection information which means where the language files should be imported from. These fields can be set:

  • Address - Address of the Fabasoft Folio domain where the language files should be imported from
  • Web Server - Web server of the Fabasoft Folio domain
  • Start Application - Application process: "Run As Current User" or "Run As {~domain~}\{~username~}:{~password~}"
  • {~domain~} - User domain
  • {~username~} - User name
  • {~password~} - Password
  • Certificate - If a certificate should be used, enter the path and the name of the certificate into this field.
  • Allow Kerberos - Select this check box if you use kerberized authentication

In the Destination area you have to select where the language files should be saved as well as the name of the language files. In the Destination Folder field you select the "LanguageFiles" folder of the project where the language files should be saved. In the Name for Language Files field you enter a name for the language files. Please note that each imported language file has the same name but different languages are saved in different folders.

After defining these properties, click "Next" to continue.

On this page you can see all languages that are imported. In the square brackets the name of the folder, where the corresponding language file is saved, is displayed. You can select and deselect languages in here. By clicking "Finish" language files for the selected languages are imported into the defined Fabasoft app.test project.

You can see the progress of importing the language files below the listed languages.

As you can see the language files have been imported. Each language file has the same name (as defined before) but for each language a folder has been created.

This has the following reason: When starting the Fabasoft app.test Player (or Recorder) you have to enter the language path, where the language files are located. Then you can reference the language file by using the langpath system parameter. If you want to run the test in another language you just have to change the language path when starting the Fabasoft app.test Player, because the name of the language file remains the same.

Imported language files can be opened and edited: