Yet another blog about WPF, Surface, SL, MVVM, NUI.... - Tag - Automation http://blog.lexique-du-net.com/index.php? In this blog we talk about WPF, Natural User Interface(NUI), Microsoft Surface, WIndows 7, Multitouch, Touchless, JavaFX, MVVM, patterns, tips, tricks .... and a lot of other things ! en Mon, 26 Feb 2024 15:40:43 +0100 Jonathan ANTOINE, All rights reserved http://blogs.law.harvard.edu/tech/rss Dotclear UIAutomation, Coded UI tests, AutomationPeer and WPF/silverlight custom controls http://blog.lexique-du-net.com/index.php?post/2011/03/23/UIAutomation%2C-Coded-UI-tests%2C-AutomationPeer-and-WPF-custom-controls urn:md5:629820d459b6479cd3dee0084d2f3179 Thu, 24 Mar 2011 00:04:00 +0100 JonathanANTOINE@falsemail.com WPF AutomationCoded UI TestsSilverlighttesttestingtestsWindows Presentation FoundationWPF <p style="margin-top: 0; ">The Coded UI Tests, available in Visual Studio Ultimate or Premium, enable the creation of automated tests for the User Interface. This is a really nice feature because you are no more forced to make "hand made" tests which takes hours to be performed.&nbsp;</p> <p style="margin-top: 0; ">The WPF controls in the framework are ready to be used by the Microsoft UI Automation which is itself used by the coded UI tests. This means that when you use the screen recorder to record the tests on your UI, it will be able to find the several control used in your application.</p> <p>When you create you own custom controls or extend standard one, the recorder would not be able to find them at first and so a whole part of the screen may not be available for tests. Actually, it is possible to record a test but every steps will be done using screen position: click at (120,30), drag from (120,30) to (10,40). This is really annoying because any changes in the UI may broke all your tests.</p> <p><br /><strong>In this post, we will see how to make a custom control fully useable in Coded UI tests scenarii. We will so answer the question "Why cannot the code UI test recorder find anything inside my WPF or Silverlight custom control ?"</strong></p> <p><strong><br /></strong></p> <p>Note: the same technique is used by the accessibility clients and by enabling this feature you also ease the people using your application through UI automation client like the partially-sighted person.</p> <p>How it works Everything is based on a class named AutomationPeer. When an UI Automation client analyzes your User Interface, it looks for an automation peer and uses it to walks trough the tree of peers. The tree of peers is nearly a visual tree but it exposes only the relevant part of the interface.  Every standard controls have a regarding... <a href="http://blog.lexique-du-net.com/index.php?post/2011/03/23/UIAutomation%2C-Coded-UI-tests%2C-AutomationPeer-and-WPF-custom-controls"><em>Read</em> UIAutomation, Coded UI tests, AutomationPeer and WPF/silverlight custom controls</a></p> http://blog.lexique-du-net.com/index.php?post/2011/03/23/UIAutomation%2C-Coded-UI-tests%2C-AutomationPeer-and-WPF-custom-controls#comment-form http://blog.lexique-du-net.com/index.php?post/2011/03/23/UIAutomation%2C-Coded-UI-tests%2C-AutomationPeer-and-WPF-custom-controls#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/72