Hi guys,
I'd like to know the best way to make my tests working also on localized controls/objects/etc
In two words, for example I have a button like "/button[@text='&Close']" but my product has also a german version , so the button will be "/button[@text='&schließen']"
Any idea?
Localized
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Localized
Hi,
If you want to create tests for different languages there are three ways how you can do it:
1: You can use the data driven approach. For each language specific name in the repo you have to
create a variable which have to be bound to a specific column in your data connector.
In your case you need a data source with the language specific names for the variables.
For instance: instead of /button[@text='&Close'] you can use /button[@text='$close'].
Where $close is your specific variable. You can set this variable with inputs from, for instance, an excel sheet.
2: You have to edit your repository items in the following way:
/button[@text='&Close' or @text='&schließen'].
3: You have to edit the RxPath in a way that you use other unique identifiers which don't change if the
Language/OS changes, which are language independent. With the Spy tool you can easily check if there are such attributes.
For more information about the RxPath and the Spy tool please take a look at the following links:
RanoreXPath
Lesson 9: Ranorex Spy
Lesson 3: Data-Driven Testing
I hope this will help you solve the problem!
Regards,
Markus
Ranorex Support Team
If you want to create tests for different languages there are three ways how you can do it:
1: You can use the data driven approach. For each language specific name in the repo you have to
create a variable which have to be bound to a specific column in your data connector.
In your case you need a data source with the language specific names for the variables.
For instance: instead of /button[@text='&Close'] you can use /button[@text='$close'].
Where $close is your specific variable. You can set this variable with inputs from, for instance, an excel sheet.
2: You have to edit your repository items in the following way:
/button[@text='&Close' or @text='&schließen'].
3: You have to edit the RxPath in a way that you use other unique identifiers which don't change if the
Language/OS changes, which are language independent. With the Spy tool you can easily check if there are such attributes.
For more information about the RxPath and the Spy tool please take a look at the following links:
RanoreXPath
Lesson 9: Ranorex Spy
Lesson 3: Data-Driven Testing
I hope this will help you solve the problem!
Regards,
Markus
Ranorex Support Team
- artur_gadomski
- Posts: 207
- Joined: Mon Jul 19, 2010 6:55 am
- Location: Copenhagen, Denmark
- Contact:
Re: Localized
If possible I suggest option 3. It requires least maintenance and should work on all languages. Controlname and UIautomationId should be good identifiers.
Re: Localized
Hi guys,
Yeah , problem solved!
Thanx for your help !
Yeah , problem solved!
Thanx for your help !
Re: Localized
Another way to consider is, putting your localized strings in Resource Files.
You can switch between the languages with CultureInfo.CurrentUICulture then. Perfect for label validations.
Don't forget to add a "using System.Globalization;" to your header
regards
Christian
You can switch between the languages with CultureInfo.CurrentUICulture then. Perfect for label validations.
Don't forget to add a "using System.Globalization;" to your header

regards
Christian
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Localized
Thanks for this suggestion!
Regards,
Markus
Regards,
Markus
Re: Localized
@admin
While using the ranorex tool for localizing a Windows app,
the container of a item changes from languages to language.
for example, consider a text box .
the RX path in English is :
/form[@title~'^Select\ Facility\ Connectio']/container[@caption~'^1\.\ Enter\ login\ informatio']/text[@class='Edit' and @instance='0']
but the Rx path in German is :
/form[@title~'^Anlagen-Verbindung\ auswah']/container[@caption~'^1\.\ Login-Informationen\ ei']/text[@class='Edit' and @instance='0']
so the path match fails giving a error.(While executing the testcase).
any solution to solve this localization
Regards,
Praneeth Arnepalli
While using the ranorex tool for localizing a Windows app,
the container of a item changes from languages to language.
for example, consider a text box .
the RX path in English is :
/form[@title~'^Select\ Facility\ Connectio']/container[@caption~'^1\.\ Enter\ login\ informatio']/text[@class='Edit' and @instance='0']
but the Rx path in German is :
/form[@title~'^Anlagen-Verbindung\ auswah']/container[@caption~'^1\.\ Login-Informationen\ ei']/text[@class='Edit' and @instance='0']
so the path match fails giving a error.(While executing the testcase).
any solution to solve this localization
Regards,
Praneeth Arnepalli
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Localized
Hello,
You could use variables for your localization in the RxPath of your elements.
These variables could be bound to a data source where each row represents a language.
Example for RxPath:
Please take a look at our User Guide for more info.
Regards,
Markus (T)
You could use variables for your localization in the RxPath of your elements.
These variables could be bound to a data source where each row represents a language.
Example for RxPath:
Code: Select all
/form[@title=$varTitle]/container[@caption=$varCaption]/text[@class='Edit' and @instance='0']
Regards,
Markus (T)
Re: Localized
About localization - it is a very good practice to also check if localized text goes out of button text field size and gets cut-off. The way this is done is to find the pairs of attributes that are available for your case but the main idea is to find for example 'textHeight' and 'textWidth' and then only 'height' and 'width' of element of type Text - then via user code compare the 2 pairs between common type attributes - width with textWidth and height with textHeight. If any of textHeight or textWidth is bigger value than corresponding height and width then this means that text is cut off and incompletely displayed.
-
- Posts: 1
- Joined: Fri Jan 29, 2016 2:34 pm
Re: Localized
Hi.
Can you please give a brief overview so as to how this can be implemented in Ranorex. I cant seem to find any way.
Can you please give a brief overview so as to how this can be implemented in Ranorex. I cant seem to find any way.