Skip to main content

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

Recently, 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>
No error - CommitEdit!#!#True!#False!##7FADCDEF!#1!#0!#0!#False!#False!#False!#True!<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.

How to use the Property?

  1. Define the object heirarchy as per your dialog design
  2. Define the objects as required Eg. WpfGridViewRow row = new WpfGridViewRow(table);
  3. Use the IsValid Property when necessary - 

[WpfGridViewRow.PropertyNames.HelpText] = "GridViewRow";
if (row.IsValid == false)

That's all. Your function will start giving the right results! 

Popular posts from this blog

Resolving INS-20802: Oracle Net Configuration Assistant failed error on Windows 10

I was all excited about the migration to Windows 10 until I had to install Oracle client on it. The Oracle client installation used to fail miserably at the last stage with this error named INS-20802.

Troubleshooting a Constantly Freezing Windows 10 PC

On my Windows 10 Home, I was being bugged by constant freezes which forced me to hard reboot now and then. Since I use Ubuntu as my primary OS, I chose to adjust with this for long. However, this became more of a trouble in the recent times with Windows starting up at 98% CPU usage and every process actually showing 0% CPU usage. That's when I decided to get into the root of the problem and resolve it. I was confident that the hardware was fine since Ubuntu worked perfectly all the time.
It turned out that many Windows 10 users, especially those who upgraded from previous versions of Windows 7 or 8 / 8.1 faced similar freezing issues. The answers at Windows Forums by Microsoft staffers generally suggested using the command sfc /scannow to verify that system files were intact. However, most users found it unhelpful and that didn't help me either.

SSL VPN: Configuring and Using Forticlient on Ubuntu, creating a Launcher

Is your primary OS at home Linux and do you use Windows only to connect to your work PC over VPN or to attend meetings? Do you often wish to connect to your work VPN from a Linux PC?  If your answer is 'Yes' to the above questions, I have an answer if your workplace uses Fortinet SSL VPN. Note that it's possible to connect to Fortinet and other VPNs like Cisco VPN from Linux through the inbuilt network manager by installing additional tools but this post would focus on using the standard Forticlient for accessing the resources on your work network.
Obtaining Forticlient The most important thing to note w.r.t. using Forticlient for Ubuntu (or any Linux distro) is to note that the client is not publicly available for download from the official website. You will have to ask your IT department to download the client for you, in case they haven't provided it.