Share via


Testing the User Interface with Automated UI Tests

You can use Visual Studio 2010 Ultimate or Visual Studio 2010 Premium to create automated tests of the user interface (UI) known as coded UI tests. These tests provide functional testing of the user interface and validation of user interface controls. Automated UI tests enable you to test that the user interface is functioning correctly after code changes. They are quicker to run than manual tests. Therefore, you can run them more frequently.

Tasks

Tasks

Associated Topics

Creating an Automated UI Test from an Existing Manual Test: You can create an automated UI test from an existing action recording from a manual test case.

Record User Actions to Create an Automated UI Test: You can record the user actions that you want to use to create an automated UI test and generate the code for a coded UI test from this recording. You can then add custom code to your coded UI test using the Code Editor.

Add UI Controls and Validation to Your Automated UI Test: You can add UI controls to your coded UI test and verify the values and the properties of the controls using the Coded UI Test Builder.

If you are testing a large application, you might have to use multiple UI maps to help create your coded UI tests.

Add Parameters from a Data Source to Use with Your Coded UI Test: You can make your coded UI test into a data-driven test by adding a data source for your test method and using the test context to run the test method for each set of data in your data source.

Link Test Cases to User Requirements: You can link your automated UI tests to user requirements. You can then determine how many automated tests you have for your user requirements.

Running Automated UI Tests: You can run coded UI tests directly from Microsoft Visual Studio 2010, from Microsoft Test Manager, from Team Foundation Build. Coded UI tests have to interact with the desktop when you run them, unlike other automated tests.

Adding Support for Custom Controls: The coded UI testing framework does not support every possible UI and might not support the UI you want to test. For example, you cannot immediately create a coded UI test of the UI for Microsoft Excel. However, you can create an extension to the coded UI testing framework that will support a custom control.

Best Practices for Coded UI Tests: You can write coded UI tests that reduce the effect of a changing UI on the program under test.

Note

By installing Microsoft Visual Studio 2010 Feature Pack 2, you can use Windows Internet Explorer 7 (or later versions) to record UI actions on a website or a Web-based application and then play back the tests using the Mozilla Firefox browser version 3.5 or 3.6. Additionally, the feature pack includes the Coded UI Test Editor which lets you easily modify your coded UI tests. Using the Coded UI Test Editor, you can locate, view, and edit your test methods. You can also edit UI actions and their associated controls in the UI control map. To download the feature pack, you must have either Visual Studio 2010 Ultimate, Visual Studio 2010 Premium or Test Professional 2010 with an MSDN subscription, Microsoft BizSpark, or MSDN Academic Alliance. For more information, see Recording Tests Using Windows Internet Explorer and Playing Back Using Mozilla Firefox, Editing Coded UI Tests Using the Coded UI Test Editor and Microsoft Visual Studio 2010 Feature Pack 2.

Running Automated Tests

You can run your coded UI tests to verify that the application meets the user's requirements. You can run coded UI tests by using Visual Studio 2010 Ultimate, Visual Studio 2010 Premium, or Visual Studio Test Professional 2010.

Supported Configurations and Platforms for Coded UI Tests and Action Recordings

If you want to verify which configurations are supported for coded UI tests, you can find the current list of operating systems, browsers, and supported technologies.

External Resources

Videos

link to videoALM 8 – Create Coded UI Test from action recording and data drive it

link to videoALM 11 - Rerecord Coded UI Test due to changes in application under test

link to videoCoded UI Tests-DeepDive-Episode1-GettingStarted

link to videoCoded UI Tests-DeepDive-Episode2-MaintainenceAndDebugging

link to videoCoded UI Tests-DeepDive-Episode3-HandCoding

Hands on lab

MSDN Virtual LabMSDN Virtual Lab: Introduction to Creating Coded UI Tests with Visual Studio 2010

FAQ

Coded UI Tests FAQ - 1

Coded UI Tests FAQ -2

Forum

Visual Studio UI Automation Testing (includes CodedUI)

See Also

Other Resources

Creating Automated Tests