We recently released a brand new XAMLFlix episode on RadPivotGrid Beta and RadAutoCompleteBox. Both of these video series are dedicated to getting you up to speed quickly with our Telerik controls for WPF and Silverlight. So while you are playing with the new controls, we thought you might like a crash course on how you can use Coded UI Testing with RadControls for WPF. We will specifically be taking a look at RadGridView, as it is one of our most popular and requested controls to show this integration with.
The video is hosted on Telerik TV and you can watch it now or download the source code for further exploration. It is also important to note that this video is the foundation of something larger to come (which is our upcoming support for Level 2, 3 and 4).
What is Coded UI Testing and why is it important to me?
Coded UI tests are automated UI tests which can be created with various versions of Visual Studio 2010 or Visual Studio 2012 Premium and up to test different kinds of user interfaces. These UI includes: Web, WPF, Silverlight and Windows Forms.
Automated UI Testing is not just limited to what Microsoft provides, Telerik provides our own with Test Studio and several others exist. Telerik wants to support whatever UI testing framework your company has chosen and with our Q3 2012 release, we have added support for Coded UI Testing for RadControls for WPF. We begin with Level 1 support and are planning to add additional levels with Q1 2013. Ill summarize what all 4 levels provide.
Coded UI Levels 1 4:
- Level 1: Basic Record and Playback This allows the recorder to record click events, identify elements, navigation and validation. This is all possible via the recorder dialog that pops up after you create a new Coded UI Test.
- Level 2: Rich Property Validation This allows assertions on custom properties and the playback engine can validate properties during test run.
- Level 3: Code Generation Special classes can be written for a control and the test code is more readable.
- Level 4: Intent Aware Actions Recorder aggregates actions based on filter rules in Action filter, can record only intended steps based on control behavior and you can set information in table cells.
What is a Coded UI Test Made-up of?
Now that you have a solid understanding of what Coded UI is and what it is made up of, lets begin by taking a look at our solution explorer of a Coded UI Test Project. This is the exact same one as shown in the video.
- Properties->AssemblyInfo.cs This contains general information about an assembly with information such as Title, Description and Version information.
- References Contains the standard Microsoft.VisualStudio.QualityTools* and TestTools*, but also includes Telerik.WinControls.CodedUI.2012.
- CodedUITest1.cs contains the actual CodedUI test class, method invocation, and assertion invocation.
- UIMap.uitest contains an XML representation of the UIMap class which includes windows, controls, properties, methods, assertions and actions.
- UIMap.cs any customization done to the UIMap are stored in this file.
- UIMap.designer.cs contains the generated code once a tester begins recording UI interactions.
Where to go from here?
So far we have discussed the different levels of Coded UI, taken a look at what the project consist of and the support that Telerik brings for it in Q3 2012. Id recommend your next step is watching the video and downloading the sample source code.
If you have any questions regarding Coded UI, then feel free to leave me a comment on this blog post or send me a tweet on Twitter at @mbcrump. You can also download the Telerik WPF control suite right now to give it a shot!
Thanks again and Ill see you in the next blog post.
About the author
Michael Crump is a Microsoft MVP, INETA Community Champion, and an author of several .NET Framework eBooks. He speaks at a variety of conferences and has written dozens of articles on .NET development. He works at Telerik with a focus on our XAML control suite. You can follow him on Twitter at @mbcrump or keep up with his various blogs by visiting his Telerik Blog or his Personal Blog.