Getting started

Jul 12, 2012 at 12:28 PM

I'm trying to de test automation on a metro app in Release Preview with 8.0P1.

I'm not getting it to work. Specifically

When I run the StartAppsWindows8RP.ps1, provided in the samples zip,from the PowerShell ISE The Metro start screen opens, but nothing happens.In the output the errors below appear

Note that I needed to add the ipmo lines to the script.

Any ideas?

 Cached                    Current                   CachedParent              CachedChildren          

------                    -------                   ------------              --------------          

System.Windows.Automat... System.Windows.Automat...                                                   

Get-UIAListItem : Get-UIAListItem: timeout expired for class: ' + , control type: ListItem, title: 

*Internet*Explorer*

At C:\Users\pten_000\Desktop\UIAutomation-1\Metro\StartAppsWindows8RP.ps1:5 char:1

+ Get-UIAListItem -Name *Internet*Explorer* | Invoke-UIAListItemClick;

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationTimeout: (:) [Get-UIAListItem], Exception

    + FullyQualifiedErrorId : ControlIsNull,UIAutomation.Commands.GetUIAListItemCommand

Get-UIAListItem : Get-UIAListItem: timeout expired for class: ' + , control type: ListItem, title: 

*people*

At C:\Users\pten_000\Desktop\UIAutomation-1\Metro\StartAppsWindows8RP.ps1:8 char:1

+ Get-UIAListItem -Name *people* | Invoke-UIAListItemClick;

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationTimeout: (:) [Get-UIAListItem], Exception

    + FullyQualifiedErrorId : ControlIsNull,UIAutomation.Commands.GetUIAListItemCommand

Get-UIAListItem : Get-UIAListItem: timeout expired for class: ' + , control type: ListItem, title: 

*messag*

At C:\Users\pten_000\Desktop\UIAutomation-1\Metro\StartAppsWindows8RP.ps1:11 char:1

+ Get-UIAListItem -Name *messag* | Invoke-UIAListItemClick;

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationTimeout: (:) [Get-UIAListItem], Exception

    + FullyQualifiedErrorId : ControlIsNull,UIAutomation.Commands.GetUIAListItemCommand

Get-UIAListItem : Get-UIAListItem: timeout expired for class: ' + , control type: ListItem, title: 

*phot*

At C:\Users\pten_000\Desktop\UIAutomation-1\Metro\StartAppsWindows8RP.ps1:14 char:1

+ Get-UIAListItem -Name *phot* | Invoke-UIAListItemClick;

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationTimeout: (:) [Get-UIAListItem], Exception

    + FullyQualifiedErrorId : ControlIsNull,UIAutomation.Commands.GetUIAListItemCommand

Get-UIAListItem : Get-UIAListItem: timeout expired for class: ' + , control type: ListItem, title: 

*calen*

At C:\Users\pten_000\Desktop\UIAutomation-1\Metro\StartAppsWindows8RP.ps1:17 char:1

+ Get-UIAListItem -Name *calen* | Invoke-UIAListItemClick;

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationTimeout: (:) [Get-UIAListItem], Exception

    + FullyQualifiedErrorId : ControlIsNull,UIAutomation.Commands.GetUIAListItemCommand

 

 

 

Coordinator
Jul 12, 2012 at 2:35 PM

Hello petertennekes,

first of all, it won't work in MIcrosoft powershell tools (both in powershellexe and in powershell_ISE) until they do something with the binaries. :)

However, they won't and there are many reasons: to test Metro UI applications, your app should be uiAccess-enabled what means 'having too high privileges'.

Microsoft's guys never, I believe, put these privileges into general-available applications.

 

For the purpose of Metro UI apps testing, the '*.for.Metro.testing.zip' package includes two utilities: UIAutomationSpy and UIARunner.

Both utilities are uiAccess-enabled provided that you imported the certificate, put them under a security location (%ProgramFiles%, for example) or tailored the appropriate policy. After you agree with UAC dialog, they'll can work with examples related to Metro UI. UIAutomationSpy is for investigating into controls and running small pieces of code. UIARunner is a typical test runner with basic report capabilities. Soon, I'll put out the Preview 2 with improvements and bug fix.

 

In my blog, I prepared a page http://softwaretestingusingpowershell.com/metro-ui-automation/ that contains/will contain step-by-step how tos, how to install and prepare and how to use the tools).

Please notice, if you saved the utilities under C:\Users and didn't disable the policy 'User Account Control: Only elevate UIAccess applications that are installed in secure locations' to allow uiAccess applications be running from outside security locations, you will fail also with our tools. That's Microsoft's security. The modules (UIAutomation.dll and TMX.dll) can be saved elsewhere.

 

Let's leave Microsoft tools only for code editing and working with traditional applications. ;) 

If instructions on the page http://softwaretestingusingpowershell.com/metro-ui-automation/ poor or too oblique, please don't hesitate to complain here: I'll improve them immediately.

Coordinator
Jul 13, 2012 at 9:45 AM

Briefly, below are things that should be implemented in aplications in order to test Metro UI apps:

"Assistive technology applications typically need access to the protected system UI elements, or to other processes that might be running at a higher privilege level. Therefore, assistive technology applications must be trusted by the system, and must run with special privileges.

To get access to higher IL processes, an assistive technology application must set the UIAccess flag in the application's manifest.

In addition to having access to higher IL processes, an assistive technology application with UIAccess can run as the topmost application in the z-order at any time, meaning that an assistive technology application can be visible and available whenever the user needs it."

http://msdn.microsoft.com/en-us/library/windows/desktop/ee671610(v=vs.85).aspx

At least, there is no reason to make powershell.exe and ISE topmost, over all the remaining windows in the system.

 

I understood that you wanted to get more output from scripts, and I added OUTPUT records to the UIARunner UI and the same output to the UIARunner_report.csv report file.

 

There are three ways to run our Metro UI testing scripts;

1) by opening a script in UIARunner and clicking on the Run button/menu item

2) by running a script from command line: UIARunner.exe [path]\script.ps1

3) by pasting the script code or calling a script from the Script tab in UIAutomationSpy

There is also the fourth way: to put your script into the UIAutomationSpy folder and rename it to UIAutomationSpy.ps1, but this way is quite useless, comparatively to three aforementioned.

 

Regardning the need to add the ipmo lines, these lines are not necessary, because both UIARunner and UIAutomationSpy load these binaries automatically if they are represented in the application's folder.

Coordinator
Jul 16, 2012 at 9:32 PM

Hello petertennekes ,

I made an experimental build of BGShell (bgshell.codeplex.com) that is working similarly to powershell.exe and ISE (with Intellisence and context menu).

http://uiautomation.codeplex.com/downloads/get/453931

Unfortunately, I managed to build only version for .NET 3.5, so that you will need to set up/download .NET 2.0/3.5 on/to your test Windows 8 (Windows 8 will offer you to download .NET 2.0/3.5).