Controls referenced during recording & controls for which assertions have been added are automatically added to the UI Control Map.

In some cases, you may want to add a control to the UI Control Map, without recording or adding assertions. In such cases, first locate the control using the cross-hair or Win+I. Then expand the Add assertions window to show the UI Control Map. Click on ‘Add Control to UI Control Map’ button. You can also use the Alt+C keyboard shortcut to add a selected control to the UI Control Map.

image

After this click on the Generate Code button on the Coded UI Test Builder Stack bar.Since you have only added a control and not added recording or assertions, you don’t need to specify a method name. Click on the Generate button to generate code and add it to the Coded UI Test Project.

image