By joining this group you will also get the opportunity to subscribe to its activity. Join this group


« go back

Validating entries in a WPF dialog using Coded UI and Telerik Properties

Combination View Flat View Tree View
Threads [ Previous | Next ]

we were faced with a challenge of capturing Tooltip text on a Telerik WPF control using Microsoft Coded UI. It took considerable research, forum discussion and support tickets to arrive at an accpetable solution.

The Problem

Here is the dialog and the tooltip text which we were trying to capture -

The issue was, the tooltip "invalid value..." used to appear only on hover and even the new properties like ToolTipText when run on the WPF row / cell containing the wrong value, were not fetching the tooltip text. The primary reason for this turned out to be, the tooltip coming up from a hidden object and Coded UI Test Builder could not identify it.

Finding a Solution

Faced with the above situation, we decided to check if the cell with value ddf exposes any property which can be of help to us. Interestingly, Coded UI Test Builder could help us distinguish between the valid and invalid values using ItemStatus property. The values used to appear like this - 

Error - CommitEdit!#!#True!#False!##7FADCDEF!#1!#0!#0!#False!#False!#False!#False!<and lot more text>


The String.Contains method could be used to validate the results but this approach lacked the elegance we were hoping for. 

The Telerik Extensions

We then discovered Telerik's extensions for Coded UI which offered an elegant solution. The process began with installing two extensions (only WPF extension might be sufficient as the case may be) -

After installing the extensions, two DLLs (can be found in Telerik Binaries folder; refer Telerik VSExtensions Options from Telerik menu in Visual Studio) need to be referenced or registered -
  1. Telerik.VisualStudio.TestTools.UITest.Extension.ExtensionsCore.dll
  2. Telerik.Windows.Controls

This completes the pre-requisites. Now 

Coded UI Test Builder would be able to retrieve more properties. For instance, IsValid True or False for values in text boxes.