Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do UI Automation of Metro-Style Apps?

I've downloaded and installed the windows 8 consumer preview, and I'd like to figure out how to use the UI Automation API's to get data from metro style applications.

Background: I have a lot of automated tests which use the Microsoft UI Automation API's to interact with applications. The scripts are written in IronRuby against .NET 4

Initially, I'd simply like to check if the start menu is visible (and if so, close it)

According to Microsoft, the normal UI Automation API's should be able to access and control metro style applications, but the problem is, I can't figure out how my code can actually access the UI of metro applications? Our normal way of viewing UI automation data is using UISpy, however when I run UI spy under windows 8 and bring up a metro app, there is no mention of it... it seems like metro apps (including the start screen) are walled off from the desktop.

If I can't find the metro apps in UISpy, how can I find what their automation ID's are, and how could I find them from my automated test scripts?

like image 211
Orion Edwards Avatar asked May 01 '12 02:05

Orion Edwards


2 Answers

A few resources on UI automation which works in Metro style apps:

  • Here is a sample demonstrating it.

  • Here is a blog post explaining it.

  • This is a forum thread on the subject.

    There is nothing about the app that stops traditional UI automation from working correctly. You may have to get updated tools to view the Metro style apps. Some ship with the Consumer Preview. Look for inspect.exe.

like image 183
Steve Rowe Avatar answered Oct 04 '22 15:10

Steve Rowe


UI Automation tools can automate Metro applications. Check RIATest for example.

Stating from version 6.0 a number of features in RIATest are specifically targeted at Metro style application automation, particularly:

  • Ability to stay on top of Metro UI to allow you to simultaneously see your Metro application and RIATest IDE and minimize switching from Desktop to Metro screens when automating a Metro application.

  • Recording of actions performed on native Windows GUI elements (including Metro GUI). The recorder analyses your script code and reuses your variable names to generate cleaner recorded scripts similar to how you would hand-code an automation script.

  • Seamless workaround for bugs like this in Windows UI Automation implementation in Metro UI.

Disclaimer: I work for Cogitek, the RIATest company.

like image 34
TN. Avatar answered Oct 04 '22 15:10

TN.