english GUI Test

Ranorex Studio, Spy, Recorder, and Driver.
MB_wiko
Posts: 93
Joined: Fri Sep 09, 2016 1:05 pm
Contact:

english GUI Test

Post by MB_wiko » Mon Dec 19, 2016 10:42 am

We recorded Ranorex with German GUI and German dates like 01.02.2017 and German numbers like 5.000,67 Euros. We inserted these data into fields an GUI with Ranorex recording. At the moment we want to test in English GUI with English format like 02/01/2017 and 5,000.67 Euros.

I attached the screenshots of recording and the German GUI:
Insertdate.JPG
GUIGerman.JPG
Does someone has a best practise to this? Record in German and play in English without much changes? For us it is no solution to record all the test cases new with English GUI. It is also no solution to set a variable and than make an if-statement in recordingfile. Much effort for changing. We schedule to offer an version for China. We will have this problem also with other languages.

Thanks a lot in Advance.
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: english GUI Test

Post by odklizec » Tue Dec 20, 2016 9:26 am

Hi,

I think the best way to achieve what you want is to use a data driven approach (described here).

Basically, you will have to variabilize all inputs in question, create a data connector with corresponding data (one row per language) and then connect the data connector with variables.

Now because you most probably don't want to run your test for all languages at once (on the same system), you can change the data connector range to run your test with just one specific language (e.g. defined via Global Parameter). The code to change the data connector range should look like this...

Code: Select all

if (language == "DE")
{
	// set data range to first row 
	TestSuite.Current.GetTestCase("TestCaseName").DataRange.MinRange = 0;
	TestSuite.Current.GetTestCase("TestCaseName").DataRange.MaxRange = 0;
	TestSuite.Current.GetTestCase("TestCaseName").DataContext.SetRange(TestSuite.Current.GetTestCase("TestCaseName").DataRange.MinRange,TestSuite.Current.GetTestCase("TestCaseName").DataRange.MaxRange);
}
else if (language == "EN")
{
	// set data range to second row 
	TestSuite.Current.GetTestCase("TestCaseName").DataRange.MinRange = 1;
	TestSuite.Current.GetTestCase("TestCaseName").DataRange.MaxRange = 1;
	TestSuite.Current.GetTestCase("TestCaseName").DataContext.SetRange(TestSuite.Current.GetTestCase("TestCaseName").DataRange.MinRange,TestSuite.Current.GetTestCase("TestCaseName").DataRange.MaxRange);						
}
Put this code to a new code module and place it just before the TC with mentioned data connector. Also, you need to create a Global Parameter "language", which should be binded to the code module (with defined "language" variable). Hope this helps? ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

MB_wiko
Posts: 93
Joined: Fri Sep 09, 2016 1:05 pm
Contact:

Re: english GUI Test

Post by MB_wiko » Tue Dec 20, 2016 11:06 am

Thanks a lot for your answer. I understand it good. It will be a hard work to capture each inserted data in e. g. csv-file for data connector. If it is the only way so I will go this way.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: english GUI Test

Post by odklizec » Tue Dec 20, 2016 1:10 pm

You are welcome.

As for better way, well, if the value you need to enter to GUI is for example a date, it should be possible to convert the value of date to appropriate data format based of the actual system settings. Just search for C#/VB .NET date conversion samples ;)

Also, you don't have to use recorded keystrokes in your recordings (like those shown in your screenshot {NumPad1} etc...). You can replace recorded keystrokes with "normal" values, like 29.11.2016.

As for other strings, I'm afraid, there is most probably no better way. Well, actually, for certain cases (e.g. huge entry forms with a lot of inputs), there IS a better way ;) But I'm afraid, it's not so simple as doing it via data connector.

Basically, you will have to write your own method, which will cycle through all necessary inputs and store their names and values to file (e.g. CSV) and then another method, that will read those values from file and insert them to appropriate GUI controls. This way you can "easily" store all necessary controls/their values to file and fill them back from file. So then you can have multiple files and use correct one per tested localized app.

I'm using something like this for our web-based app and it's a real time saver ;) However, it took me some time to develop this method and I'm afraid, it's quite web-centric and related just to our app. So it will be of no use for you.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

MB_wiko
Posts: 93
Joined: Fri Sep 09, 2016 1:05 pm
Contact:

Re: english GUI Test

Post by MB_wiko » Tue Dec 20, 2016 1:22 pm

Thanks for answering, these are very goods ideas. Sorry that I asked for so a simple solution like C#/VB .NET date conversion. :oops:

MB_wiko
Posts: 93
Joined: Fri Sep 09, 2016 1:05 pm
Contact:

Re: english GUI Test

Post by MB_wiko » Mon Jan 02, 2017 3:44 pm

Just one question back: You worte:

Also, you need to create a Global Parameter "language", which should be binded to the code module (with defined "language" variable). Hope this helps? ;)

How can a bind a global parameter to a code module? I didn't find a solution in internet.

MB_wiko
Posts: 93
Joined: Fri Sep 09, 2016 1:05 pm
Contact:

Re: english GUI Test

Post by MB_wiko » Mon Jan 02, 2017 3:59 pm

I just tried it: But the Methode GetTestCase has no reference: I replaced "TestCaseName" with the real name, but Ranorex didn't find a reference?!? Where can I find the Testcasename?
Unbenannt.JPG
Thanks a lot.
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: english GUI Test

Post by odklizec » Mon Jan 09, 2017 9:20 am

Hi,

You should use TestCase name (a folder in Test Suite, which contains recordings/code modules), not the data connector name!
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration