Coded UI testing support for Silverlight

After we shipped VS 2010, we shipped a “Testing Feature Pack” that included support for testing Silverlight 4 applications using UI automation. Our full intent was to incorporate that support into VS 2012. Unfortunately, there were so many competing priorities, we just didn’t have time to get it in – and what’s more we released Silverlight 5, further widening the gap in our support.

As VS 2012 has been winding down, the team has had some “spare” time and has done some work to take the original Silverlight support, extend it to also support Silverlight 5 and package it up as a download. You can get it from the Visual Studio Gallery here: http://visualstudiogallery.msdn.microsoft.com/28312a61-9451-451a-990c-c9929b751eb4. It works for both Silverlight 4 and 5, runs in either VS 2012 RC or the final VS 2012 release (once it’s available), requires either VS Premium or VS Ultimate and works only with browser hosted Silverlight – using either IE 8, 9 or 10.

Whether or not this ultimately become “more supported” than this, will depend on how much uptake there is. If a lot of people use it and give us feedback on it, we’ll look at what further should be done.

Tags

Join the conversation

Congrats, Is it possible to do code coverage in Silverlight tests and run them on TeamBuild?

4 years ago

Niclas Lindgren

The uptake would likely be a lot larger if there was a proper story for SL. As it is now, a lot of application are and were developed in SL just as MS switched gears. SL is a much better technology than HTML will ever be, it is sad that some realize this and put in some extra hours for the good cause.

We welcome this addition as it will enable us to move to SL5 once XP support can be dropped…

Very much appreciate the additional SL5 support for VS2012 RC and beyond. I've tried to implement against an SL5 project (already in production) while running VS2012 RC Ultimate, with necessary references in all SL5 projects within the solution to C:Program Files (x86)Common Filesmicrosoft sharedVSTT11.0UITestExtensionPackagesSilverlightUIAutomationHelperv5.0Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll

Unfortunately when I attempt to Record actions and click on one of my named and displayed TextEdit fields (DevExpress v11.2.8.5) I suffer the folowing error (messagebox):

"An exception occurrred when trying to discover information about a Silverlight control."

Through this plugin, we have extended existing VS2010 support for SL4 controls to SL5 controls. Hence, the supportability of custom controls remains the same. Please refer to msdn.microsoft.com/…/gg313838 for a list of supported controls: "Third-party controls might not be supported, depending on how these controls were created."

However, if you want us to take a deeper look into the problem, we would require details through UITest logs. Please enable logging and feel free to post the logs here: visualstudiogallery.msdn.microsoft.com/28312a61-9451-451a-990c-c9929b751eb4

4 years ago

Jessica Thurston

We are in desperate need to test Google chrome versus IE 9 and we have a large suite of codedui tests written against IE9, is there any way to have codedui tests work against google chrome? I can't seem to find google chrome listed anywhere – msdn.microsoft.com/…/dd380742.aspx. The majority of our customers over the last 12 months have been using Chrome and mgmt. has now mandated that our app (it's a billing app for major eclectic utilities) work identically with google chrome.

Actually, it will work. You can both collect rich action logs and use the record & playback feature.

Brian

4 years ago

Adam W

Brian, I'm stuck, I am getting:

"No Silverlight controls were detected. Verify that the application under test is built using Silverlight assemblies wiht a version of 4.O or greater and that a reference to the Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll assembly has been added to the project. For more information, see go.microsoft.com/fwlink

I have VS 2010 Premium, Silverlight 5, I have executed your app, I also added SilverlightAutomationHealper.dll to my main project. I am able to record login, which is handled by aspx page and after I am getting message quoted above. This causes recorded to "forget" everything what was recorded before. Any suggestions?

Do you have Visual Studio gallery plugin (valid for VS 2012) installed on your machine or do you have feature pack (valid for vs 2010). In feature pack we only supported Silverlight 4 applications.

4 years ago

Adam W

Siddhartha, Thank you, I have both of those installed: VS 2010 Feature Pack2 and your Visual Studio UI Test Plugin for Silverlight. I was running the Test UI from VS 2010 which I realized was my mistake…

I have removed VS 2010 Feature Pack2 from computer and I have reinstalled Visual Studio UI Test Plugin for Silverlight.

Now I am trying to create new test in VS 2012 Premium ver 11.0.50727.1 RTMREL

How do I start recording a new test? I am trying to follow steps from here: msdn.microsoft.com/…/gg413374.aspx and I am stuck in step 3: I don’t have new "Test Project template" available under "Test" in "Visual C#" in my "Add New Project" view.

4 years ago

Adam W

Siddhartha, I was able to start recording by adding "Coded UI Test Project" to my solution… Of course!

However it still doesnt record Silverlight 5.

"No Silverlight controls were detected. Verify that the application under test is built using Silverlight asemblies with version of 4.0 or grater and that a reference to the Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll assembly has been added to the project. "

And I am running VS2012 with Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper in Silverlight project and your plugin is installed. What I am missing?

If the application is build on Silverlight 5 then you need to build your application with corresponding Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper that is build against Silverlight 5.

When you install the Visual studio gallery plugin you can find this dll in C:Program Files (x86)Common Filesmicrosoft sharedVSTT11.0UITestExtensionPackagesSilverlightUIAutomationHelperv5.0

PS: When you open your Silverlight 5 application and try to add reference you can find the corresponding SilverlightUIAutomationHelper in the extension list of dlls. You can add reference from there also.

If you are still facing issues please do mail me at siddharthaDOTpandeyATmicrosoftDOTcom.

4 years ago

Adam W

Siddhartha, Your comments about Silverlight versions helped me to find the error, I have just recently changed project from SL 4 to SL 5 and I was trying to record UI test against my old build done in SL4! As soon as I started to record against my new build on localhost the UI started to recognize SL controls. Thank you!

4 years ago

Ray L

Silverlight 5 has been released more than 1 year. I can’t believe that coded UI test doesn’t support Silverlight 5 very well. It causes the issue all the time.

Adding support for SL on IE 11 is on our backlog. We don't have dates to share just yet, but we will blog about it once the work is complete and ready for customers to use.

Thanks,

Prachi

3 years ago

Prabhu

I am using Visual studio 2012 Coded UI for Automation but SL4 and SL5 controls are not Identifiable in IE 9, IE10 & IE11 but in IE 8 it is working perfectly, could anybody let me know do i need to do any setting in the IE ? , now we blocked from using IE9 & IE10.

Please send me an email at pagarwalATmicrosoftDOTcom with replies to above query and we will take it forward from there.

3 years ago

hay

good

1 year ago

Ambika Devraj

Hi,

I am using VSTS 2013 Ultimate and using Coded UI to test Silver light 5 application.Here I am able to record the scenario and able to execute as well but while adding assertions it is not detecting particular control that we expect.

I have added all supportive dll to the project.

Could you please help me in resolving this issue of detecting control in SL 5 application while adding assertions?

1 year ago

Atin Bansal [MSFT]

@Ambika

If you are able to playback successfully, you should be able to Assert also. Can you please mail me at atinb at Microsoft dot com with how you are trying to assert and we can help you out?