Testing Silverlight Applications with Coded UI Tests or Action Recordings
Using Microsoft Visual Studio 2010 Feature Pack 2, you can create coded UI tests or action recordings for Silverlight 4 applications. Action recordings let you fast forward through steps in a manual test. For more information about action recordings or coded UI tests, see How to: Create an Action Recording or How to: Create a Coded UI Test.
To use this feature, you must add Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll as a reference to your Silverlight 4 application so that the Silverlight controls can be identified. This helper assembly instruments your Silverlight application to enable the information about a control to be available to the Silverlight plugin API that you use in your coded UI test or is used for an action recording.
This assembly cannot be redistributed. Therefore, you must add this reference conditionally to your Silverlight project. By taking this approach, the assembly is not redistributed when you deploy your software to a customer.
If you want to run your coded UI tests remotely for your application, you must install the Microsoft Visual Studio 2010 Feature Pack 2 on any computer that has a test agent or a test controller that you will use to run the tests. For more information about how to run coded UI tests, see How to: Set Up Your Test Agent to Run Tests that Interact with the Desktop and Running Automated Tests.
If you want to build the test project that contains your Silverlight coded UI tests as part of team build using a build agent, you must install the Microsoft Visual Studio 2010 Feature Pack 2 on any computer that has a build agent that is used to build the test project. For more information about how to build and run tests, see How to: Configure and Run Scheduled Tests After Building Your Application.
Use the following topics to help you set up your Silverlight application and create your tests.
Setting up your Silverlight 4 project to Create Coded UI Tests or Action Recordings: You must first set up your Silverlight 4 project to include a helper assembly to instrument your Silverlight 4 application. You must also make sure that your Silverlight controls each have a unique automation property.
Creating Coded UI Tests to Test a Silverlight 4 Project: You can create coded UI tests for your Silverlight application after you have included the helper assembly and you have unique automation properties for your Silverlight controls.