Partager via


UIAutomation sample project -- WPF, WinForm, UIA, ServerSideProvider, Timing, WaitForReady, DataBinding

Related reading:

https://blogs.msdn.com/b/lixiong/archive/2009/12/05/ui-automation-under-the-hood.aspx

https://blogs.msdn.com/b/lixiong/archive/2009/03/28/msaa-uia-brief-explanation.aspx

Chinese:

https://www.cnblogs.com/stbchina/archive/2010/01/25/Tech-Trend-of-Microsoft-UI-Automation-Testing-Part-1.html

Based on my UI Automation test experience, I created a sample project. In the project, it contains:

1. WPF as test target.

2. WinForm as a test target.

3. Test code to Automate WPF and WinForm.

4. Test code to Automate calc.exe for Win7.

5. A simple Test Framework.

It demonstrates:

1. Basic usage of UIA, like UI element probing with AutomationID, Name property. UIA pattern usage.

2. How to set AutomationID for databinding item in WPF.

3. Use Sleep, polling and event to deal with timing issue.

4. Use Waiter Pattern to simplify the timing solution.

5. Basic implementation of WaitForReady.

6. Click and Invoke.

7. Concept of UI Test Framework.

8. Use AutomationPeer to implemente InvokePattern for self-draw WPF control.

9. Implement Server side provider for WinForm.

The following interface/class is demostrated:

AutomationElement, WindowPattern, CacheRequest, SendInput, InvokePattern, ValuePattern, UserControlAutomationPeer, AutomationPeer, IRawElementProviderSimple, RaiseAutomationPropertyChangedEvent, ReturnRawElementProvider, ProviderOptions, HostProviderFromHandle

DownloadURL:

https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-69-39/3225.UIASamples.zip

Comments

  • Anonymous
    December 17, 2010
    I am not able to open the zip and all files within this.

  • Anonymous
    January 17, 2011
    the link is fixed. thanks.