Things to Keep in Mind While Working With Telerik Test Studio VS Plugin

Hi Friends,

Lately, I have been working on automating the test cases for our Silverlight Applications. After trying what is available out there, I can easily vouch for Telerik Test Studio. It's the most advanced Test Automation tool available out there for Silverlight Applications.
Telerik Test Studio comes with a VS plugin that allows you to do nearly everything that is possible via its standalone product.

However there are a few points that I found, we need to keep in mind to make the best out of it. This article lists all those items/precautions for you.

1. Names of the test cases/steps

When writing new test cases or test steps, try and avoid using special characters as much as possible. For example use "and" instead of "&".

This will help save you many run time errors that are very difficult to spot otherwise. I struggled with it for a lot of time and my test cases were failing and throwing errors like "MyProjectName.dll" assembly not found, where at the end the issue was related to an "&" that I had in one of my test cases.

2. Renaming Test Cases

This is another painful area of VS extensions of Telerik test Studio. Name the test cases carefully in the first go, keep a check on lower and upper case letters since they play a huge role for deciding the names of the underlying classes.

For example: suppose I have a test case named "Create New Company" the underlying class name will be something like "ProjectName.Foldername.Create_New_Company".

Now, if for some reason you decide to rename it to "Create new company", all of you think that you have changed a couple of letters from upper case to lower case, but the class name in this case changes to "ProjectName.Foldername.Createnewcompany".
This is not all, even after you clean your project and rebuild it, the libraries don't update all the time to use this new class name amd as a result the test cases can start failing again with a Not Found exception. The workaround is to check the error logs to know what class name it's trying to look for, and update yours back to the ones that is being looked for.

3. Selecting item in a List, Combo Box or Data Grid

Another headache that I found and a workaround after banging my head against the wall for 2 days.

Silverlight loves rendering the UI only as much as it needs to display per view port. For example if you have a screen with a data grid that shows 10 records per view port (the area the user can see without scrolling down) then Silverlight will only hold 12 records in the background. 10 in the view port, 1 at the top and 1 at the bottom of it.

This becomes a major issue when you need to look for an item that is not available in the current view port. The only possible solution is to... guess it... SCROLL to the item via code.

To give you an idea, the following is the code we use for finding a row in the grid.


//finds & retuns the grid row to be selected

        public static GridViewRow FindGridRow(string textToFind, RadGridView rgv)


            int verticalOffset = 0// Holds the current vertical offset in the viewport

            int viewPortHeight// The height of the visible part of the grid

            int extentHeight// The total height of the grid, visible plus non-visible


            // Grab the VirtualizingPanel contained in the RadGridView. This is used to control the viewable portion of the grid.

            FrameworkElement VirtualizingPanel = rgv.Find.ByType("GridViewVirtualizingPanel");


            // Detect the view port height and the extent height

            viewPortHeight = (int)VirtualizingPanel.GetProperty(new AutomationProperty("ViewportHeight"typeof(int)));

            extentHeight = (int)VirtualizingPanel.GetProperty(new AutomationProperty("ExtentHeight"typeof(int)));


            // Make sure it is scrolled to the very top

            // Walk through the entire grid verifying the data


            while (verticalOffset < extentHeight)


                foreach (GridViewRow row in rgv.Rows)


                    if (row.Find.AllByTextContent(textToFind).Count > 0)


                        return row;



                // Scroll down one page

                verticalOffset += viewPortHeight;




            return null;


Also, for Combo Boxes I suggest adding another recorded step to pop the list open before going into the code to iterate through each of its items to find the one you are looking for.

Having the combo box open, before you start reading the items in code makes sure that the items are visible.

4. Rendering UI items in code

Last but not least, this one is very close to what we discussed above and I think its better explained with a few images.

Suppose you have a grid like this:


Where you are adding Company Details and the Company Name column has a fixed width and uses a word ellipses to show the clipped name on the grid.

When you try and find a row that contains a certain text by:


Where TextToFind could be "hf 65194215 Some Company Name Inc".

You will end up with no results at all, because Find.AllByTextContent tries to match the exact text content and not a part of it.

The problem is that your variable (TextToFind) has the entire length of the company name whereas on the grid items all that is available is "hf 65194215…" since the method is looking for Exact Match, its not found for obvious reasons.

To overcome this, a pretty simple workaround and the one that always works is to have the width of the column increased such that it starts showing the entire content.

We are doing this by adding a recorded test step, just before the one that tries searching for the text in the grid via code.

5. Wait for execution

In some of your scenarios its good to hold the execution for some time before jumping into the next step to validate and search for an item.

For example, in the same screen shot above if you have written an automated test case that finds a row and deletes it, it's a good idea to add a new step to pause the execution for 200 milliseconds before validating that the item is no more available on the UI. Sometimes the code execution is so fast that it executes even when a deleted record is still visible on the grid.

Off course this last comment is relevant on a case by case basis and you are the best judge to decide where you want to hold the execution and for how long, my point is don't always think that the execution will be fast enough to pass the next step. Having a small wait could be worth it.

These are some of my experience with Telerik Test Studio's VS Plugin that, when you follow them, you are sure to save a lot of time.

Hope you enjoyed reading this and find the article useful.

Please don't mind sharing your valuable feedback

Enjoy Coding.

Similar Articles