Generate Code for Coded UI Test [Beta2]

When a Coded UI Test is created, a set of files are added to the Project. Code can then be generated and added to the Coded UI Test project

  1. By using an action recording associated with a test case.

When a manual tester runs a test case in Microsoft Test Runner and publishes the results to Team Foundation Server, an action recording is associated with a test case. This action recording is an XML file which describes the controls and actions performed on them. Code will be generated corresponding to actions and controls in the action recording.


2. By using the Coded UI Test Builder


Using the Coded UI Test Builder, you can

a. Record your test steps

b. Add controls to a UI Control Map and then use these controls to perform test actions.

c. Add Assertions on UI Controls


3. By Hand-coding

In this case, tool does not generate any code. UITesting API can be used to locate controls on a user interface,  perform actions on them and validate its properties.



These options are available from the Generate Code for Coded UI Test dialog.


They can also be accessed from the context menu in a Coded UI Test method.


These options are also available from the menu under Test.


Comments (4)

  1. Juan Trujillo says:

    Hi Mathew,

    Is it possible to identify all the controls from an application form(WinForms) without having to click one conrol at a time ? I’m thinking about a discovery method or something similar.

  2. It is not possible in the current release.

    We are proposing to release a Power tool which will identify all controls contained inside a specified container and add it to the UI Control Map.  

  3. Angus McCotupp says:

    Hi Mathew, did this Power Tool ever get released?

  4. Shiv Prabhakar says:

    Hi Methew, about a year back you're saying about the release of Power tool. Is it got released?

Skip to main content