UIA for Win8 Metro App UI test RRS feed

  • Question

  • Can UIA's API be used for metro App UI test?

    Where can I found some resource for UIA test for Metro App test?

    Great Wall

    Monday, March 12, 2012 3:21 AM


  • Hi,

    The native-code UIA API can be used for verifying Metro style app UI. The existing UIA samples at MSDN show steps for accessing UI data and similar steps would work for a Metro style app. The UIA API has been extended to allow the CoCreate of a CUIAutomation8 object as well as a CUIAutomation object. (CUIAutomation8 supports the IUIAutomation2 interface, http://msdn.microsoft.com/en-us/library/windows/desktop/hh437194(v=vs.85).aspx.)

    There are two particularly important enhancements to UIA in Windows 8. The first relates to the threading rules which must be followed by client apps. In Windows 7, client apps must use background MTA threads if they use UIA event handlers or use UIA to interact with their own UI. The use of such threads is standard for many apps anyway, but the rules might introduce extra work for some apps. (Most of my samples at http://code.msdn.microsoft.com/site/search?f%5B0%5D.Type=User&f%5B0%5D.Value=Guy%20Barker%20MSFT demo the use of the MTA threads.) In Windows 8, these threading rules no longer exist. UIA event handlers can be added and removed on the client app's main UI thread, and the app can interact with its own UI from that thread.

    The second important enhancement in Windows 8 relates to unresponsive provider apps. In Windows 7, if a client app used UIA to interact with some provider app's UI, and that app was unresponsive, then the UIA call could block until the provider responds. In Windows 8, the UIA calls made by the client will timeout if the provider's unresponsive. This means that assistive technology (AT) apps which use UIA, (such as screen readers), won't block due to a hanging provider app, but rather the AT app can inform the user that some app UI is unresponsive.

    Assistive technology apps should generally not be showing user interfaces over a Metro style app because it can be confusing to the user.  However, in some rare cases this may be necessary.  It can be achieved using UI Access, which is only to be used by accessibility applications and some test tools. Details of UIAccess can be found at http://social.msdn.microsoft.com/Forums/en-GB/toolsforwinapps/thread/8529357f-3ff8-4c83-baaf-5215ca9cc14a.



    Wednesday, March 14, 2012 4:23 PM