User Guide Calculator Test script

Ask general questions here.
farhanzom
Posts: 12
Joined: Mon Jul 26, 2010 12:58 pm

User Guide Calculator Test script

Post by farhanzom » Mon Jul 26, 2010 1:04 pm

Hi,
I'm a beginner in automation and also Ranorex, I downloaded it recently and tried to follow the online user guide. I created a test project by following the guide for recording and replaying the script for the calculator application. I started recording, opened the calculator clicked 5 + 5 = 10 and clicked validate, however for some reason the value 10 which is the sum is not showing in Text value field, it is always blank, I'm not sure why this value is not being populated, I'm on Windows 7 platform.

What am I doing wrong, can someone please help?


Cheers,
Farhan

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: User Guide Calculator Test script

Post by artur_gadomski » Mon Jul 26, 2010 1:53 pm

I think calculator user guide is written for windows xp calculator application.

farhanzom
Posts: 12
Joined: Mon Jul 26, 2010 12:58 pm

Re: User Guide Calculator Test script

Post by farhanzom » Mon Jul 26, 2010 2:16 pm

Thanks artur, you may be right, I guess it could be an OS related issue.

Cheers

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: User Guide Calculator Test script

Post by Support Team » Mon Jul 26, 2010 3:13 pm

Hi farhan,

The Calculator sample is for the WinXP calculator, and because the Win7 calculator is completely different, our sample doesnt work anymore under Windows 7. If you open the sample, there should be a message if the windows version is wrong.

So you are doing nothing wrong :)
Please have a look at the other samples.

Michael
Ranorex Team

farhanzom
Posts: 12
Joined: Mon Jul 26, 2010 12:58 pm

Re: User Guide Calculator Test script

Post by farhanzom » Mon Jul 26, 2010 3:48 pm

Hi Michael,

Thanks a lot for your quick response. That helps a lot. Well, the thing is I didn't open the sample file I just followed the guide and used the Windows 7 calculator for testing, maybe that's why I didn't receive any error message.

I'll try other samples.

Cheers,
Farhan

farhanzom
Posts: 12
Joined: Mon Jul 26, 2010 12:58 pm

Re: User Guide Calculator Test script

Post by farhanzom » Mon Jul 26, 2010 4:09 pm

Hi Michael,

I tried recording a test on Windows 7 calculator. These are the steps I followed:

-opened Ranorex studio
-created a test project called TestCalculator
-Clicked on Record
-navigated to Calculator through Windows startup
-Clicked 5 + 5 =
-it showed 10
-then I clicked on validate and moved the mouse pointer to the text field of the calculator till it was highlighted.
- Then I clicked on stop and I played the recording
I got a message saying :


2010/07/26 16:05:10.149 SUCCESS Validation Attribute 'Text' of element for item 'FormCalculator.Text160' does match the specified value.

My original issue is still there, why am I getting this message? Why is it saying does not match? It should be saying matched.

I have attached the logs for you to verify.


Cheers,
Farhan
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: User Guide Calculator Test script

Post by Support Team » Mon Jul 26, 2010 4:31 pm

Hi farhan,

The problem with the Win7 calculator is that the result text field is actually "behind" the element tracked by the recorder/spy. In this case you have to use the Spy to navigate through the element tree and look for a text field which has the correct value.
If you look at your logfile, you can see that the text you are validating is actually empty (Text='')

In your case the path to the element you are looking for is (relative to the calculator form)
element/container[@class='#32770']/text[@controlid='150']

You can add this as a new item to your "FormCalculator" folder an then select this item for validation.

Note that this is usually not necessary, but there are a few special cases in every application where you need to dig around in the element tree to find what you are looking for.

Cheers,
Michael

farhanzom
Posts: 12
Joined: Mon Jul 26, 2010 12:58 pm

Re: User Guide Calculator Test script

Post by farhanzom » Mon Jul 26, 2010 5:07 pm

Hi Michael,

Thanks once again for your quick response. I got the point, I'll follow the steps you mentioned and will let you know if my test succeeds.


Cheers,
Farhan

kmac
Posts: 1
Joined: Mon Aug 02, 2010 5:52 pm

Re: User Guide Calculator Test script

Post by kmac » Mon Aug 02, 2010 6:15 pm

I had the same exact problem and the solution in the thread worked but I guess I don't understand how I could've found that element on my own. I searched with the spy and I didn't see text 150. Can you please explain how you found this hidden element?

Thanks,
Kyle

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: User Guide Calculator Test script

Post by artur_gadomski » Tue Aug 03, 2010 6:33 am

When you track some element with Spy it points you directly to where that element is within application. But it lists also other elements which structure you can freely browse.
So track main text field of calculator, then in spy expand one of the containers and find your Text'0' field.
See attached screenshot.
It is a good idea when you're starting with Ranorex to play around with Spy by highlighting different elements in your application.
You do not have the required permissions to view the files attached to this post.