Telerik blogs

Introduction

Hello again!

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. I’ll summarize what all 4 levels provide.

Coded UI Levels 1 – 4:

  1. 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.
  2. Level 2: Rich Property Validation – This allows assertions on custom properties and the playback engine can validate properties during test run.
  3. Level 3: Code Generation – Special classes can be written for a control and the test code is more readable.
  4. 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, let’s 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.

image

  • 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. I’d 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 I’ll see you in the next blog post.


MichaelCrump
About the Author

Michael Crump

is a Microsoft MVP, Pluralsight and MSDN author as well as an international speaker. He works at Telerik with a focus on everything mobile.  You can follow him on Twitter at @mbcrump or keep up with his various blogs by visiting his Telerik Blog or his Personal Blog.

Comments

Comments are disabled in preview mode.