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.

image

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

image

These options are also available from the menu under Test.

image