I was playing around with the new (well, new-ish) Silverlight 4 Coded UI Tests that came with Visual Studio 2010 Feature Pack 2 this weekend.
I trying to create a Coded UI test using the recorder and kept getting the following error:
No Silverlight controls were detected. Verify that the application under test is built using Silverlight assemblies with a version of 4.0 or greater and that a reference to the Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUlAutomationHelper.dll assembly has been added to the project. For more information, see http://go.microsoft.com/fwlink/?Linkld=204562
I actually had added the reference to SilverlightUIAutomationHelper.dll from my Silverlight application (NOTE: it’s the Silverlight client project not the Coded UI test project) already. So that wasn’t the problem.
Next I found that my strong opinion that you shouldn’t name your Silverlight controls (no x:Name’s) was probably causing a problem. This page talked me through what I needed for naming and, conveniently enough, Expression Blend has a utility that will do it for you.
I still had the error. Now I started wondering if it had something to do with running IE9 beta.
The Answer: Yes. In order to use the Coded UI Test Builder with Silverlight 4, you have to run Internet Explorer 9 (IE9) in Compatibility Mode. http://blogs.msdn.com/b/vstsqualitytools/archive/2011/03/09/coded-ui-support-for-ie9-with-sp1.aspx
Run your application and click the Compatibility Mode button in the URL box (see image below).
Re-run the Coded UI Builder and now you’ll be able to do a coded UI test.
I hope this helps.
-Ben
-- Looking for help with Team Foundation Server 2010 (TFS2010) & Microsoft Test Manager (MTM)? Having problems with your Silverlight architecture? Need some suggestions about how to start QA testing your Silverlight 4 applications? Drop us a line at info@benday.com.