Testing Metro style windows 8 app

Best practices, code snippets for common functionality, examples, and guidelines.
User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Testing Metro style windows 8 app

Post by Ciege » Sat Dec 08, 2012 12:23 am

Ahhh, wait a minute now...

Please check this link:
http://stackoverflow.com/questions/1174 ... deployment

Seems you need to package and deploy your app since its a Metro style app.

In the second link see the section titled "Deploy and run".
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

vasudha.c8
Posts: 16
Joined: Fri Dec 07, 2012 6:05 pm

Re: Testing Metro style windows 8 app

Post by vasudha.c8 » Sat Dec 08, 2012 12:59 am

Yes I am trying to do this with package only. Also If i try to invoke a live tile , ranorex cannot locate it even if the path is specified correctly .

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Testing Metro style windows 8 app

Post by Support Team » Mon Dec 10, 2012 2:16 pm

Hello,

Microsoft added a lot of new security features in Windows 8. These features make it more difficult to access apps for Ranorex.

Please try to insert the following lines at the beginning of your main method.
if (Ranorex.Core.Util.IsRestartRequiredForWinAppAccess)   
 return Ranorex.Core.Util.RestartWithUiAccess();
Please let me know if it works.

Regards,
Bernhard
.
Image

vasudha.c8
Posts: 16
Joined: Fri Dec 07, 2012 6:05 pm

Re: Testing Metro style windows 8 app

Post by vasudha.c8 » Mon Dec 10, 2012 6:07 pm

Thanks Bernhard.

These lines will go in Program.cs of ranorex suite or my class file in visual studio? And also do i need to reference any ranorex modules in my project in visual studio?

vasudha.c8
Posts: 16
Joined: Fri Dec 07, 2012 6:05 pm

Re: Testing Metro style windows 8 app

Post by vasudha.c8 » Tue Dec 11, 2012 1:15 am

I upgraded my ranorex version to 4 and also made the changes suggested. Now i dont get any launch of my app or not even I get any error message. Ranorex runs and stops with no test report.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Testing Metro style windows 8 app

Post by Support Team » Tue Dec 11, 2012 2:53 pm

Hello,

Could you please describe exactly how you start your app. Do you start the app with Ranorex Studio? If yes, did you start Ranorex as Administrator?
Thank you!

Regards,
Bernhard
.
Image

vasudha.c8
Posts: 16
Joined: Fri Dec 07, 2012 6:05 pm

Re: Testing Metro style windows 8 app

Post by vasudha.c8 » Tue Dec 11, 2012 6:40 pm

Hi,

Yes I start the app from Ranorex Studio after starting Ranorex as administrator , But even the same nothing happens . ranorex starts and stops.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Testing Metro style windows 8 app

Post by Support Team » Wed Dec 12, 2012 1:40 pm

Hello,

Please make sure that you don't enable 'Run this program as an administrator in the 'Compatibility tab' of Ranorex Studio shortcut. You need to right-click on Ranorex Studio an select 'Run as administrator' as mentioned by Bernhard.

Could you please try out the attached example and run it in Ranorex Studio?
It should open and close the 'Weather' app in Windows 8.

Could you please post a screenshot from the behavior?
Is your AUT a custom app or a Windows 8 integrated app?

Regards,
Markus (T)
Attachments
MetroGUITest.zip
(30.73 KiB) Downloaded 250 times
.
Image

vasudha.c8
Posts: 16
Joined: Fri Dec 07, 2012 6:05 pm

Re: Testing Metro style windows 8 app

Post by vasudha.c8 » Wed Dec 12, 2012 7:02 pm

Hello,

The code sample which you sent works well with ranorex. I want to know how do you invoke the weather app for recording through ranorex? I meant the code for invoking it.. I am trying a simple scenario of invoking the application through Program.cs rather than record and play.

I am trying to work with the custom app which i have developed and it is not in Windows store .. I am trying to use ranorex to test the app completely before submitting or deploying in windows store...

vasudha.c8
Posts: 16
Joined: Fri Dec 07, 2012 6:05 pm

Re: Testing Metro style windows 8 app

Post by vasudha.c8 » Wed Dec 12, 2012 8:48 pm

I am able to generate a recording now with record and play :) . Thanks for all the help.

But i wanted to know if I can generate a recording manually as in invoking the app from Program.cs file of Ranorex studio.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Testing Metro style windows 8 app

Post by Support Team » Thu Dec 13, 2012 2:21 pm

Hi,

Yes, you can also manually "generate" a recording as described in the following blog:
Did you know… that you can manually generate a recording?.
Just one question, why are you invoking your app in the Program.cs?

Regards,
Markus
.
Image

vasudha.c8
Posts: 16
Joined: Fri Dec 07, 2012 6:05 pm

Re: Testing Metro style windows 8 app

Post by vasudha.c8 » Thu Dec 13, 2012 11:39 pm

Thank you.

I was just trying through Program.cs if i could. But its ok i figured out other way around.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Testing Metro style windows 8 app

Post by Support Team » Fri Dec 14, 2012 9:40 am

You can also use the Host.ActivateWindowsApp method to activate your app. When the app is not started, yet, this method will start the app. If it's already started, it will bring it to front.
You can get the values for the "appId" and the "appFamilyName" arguments by tracking your app with Ranorex Spy.

Regards,
Alex
Ranorex Team
.
Image

vasudha.c8
Posts: 16
Joined: Fri Dec 07, 2012 6:05 pm

Re: Testing Metro style windows 8 app

Post by vasudha.c8 » Fri Dec 14, 2012 6:58 pm

Thank you .