共用方式為


System Testing with Coded UI Tests

Automated tests of the user interface (UI) are known as coded UI tests. These tests provide functional testing of the UI and validation of UI controls. You can create coded UI tests to determine that the UI is functioning correctly after code changes.

Coded UI tests are often used in Visual Studio solutions to quickly verify correct code functionality and as a quality gate prior to checking in code changes. Coded UI tests can complement the unit tests in a Visual Studio solution. For more information, see Verifying Code by Using UI Automation and Verifying Code by Using Unit Tests.

You can also create coded UI tests to automate manual tests that you created in Microsoft Test Manager. These automated manual tests can then be included in your Team Build configurations as part of your integration testing.

Requirements

  • Visual Studio Ultimate, Visual Studio Premium

Tasks

Tasks

Associated Topics

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

Record User Actions to Create an Automated UI Test: 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, or by using the Coded UI Test Editor.

Add UI Controls and Validation to Your Automated UI Test: 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: 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: Link your automated UI tests to user requirements. You can then determine how many automated tests you have for your user requirements.

Edit coded UI tests using the Coded UI Test Editor: The Coded UI Test Editor lets you easily modify your coded UI tests. Using the Coded UI Test Editor, you can locate, view, and edit your test methods, UI actions and their associated controls in the UI control map.

Running Automated UI Tests: Run coded UI tests directly from Visual Studio, 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: Write coded UI tests that reduce the effect of a changing UI on the program under test.

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

Guidance

Testing for Continuous Delivery with Visual Studio 2012 – Chapter 2: Unit Testing: Testing the Inside

Testing for Continuous Delivery with Visual Studio 2012 – Chapter 5: Automating System Tests

FAQ

Coded UI Tests FAQ - 1

Coded UI Tests FAQ -2

Forum

Visual Studio UI Automation Testing (includes CodedUI)