How to get UI Controls with Coded UI Test Builder without recording actions

Author: Alfonso Alarcón

One of the most powerful technologies to work with automated testing is the Coded UI Test Builder included in the Enterprise version of Visual Studio 2015 (previously Premium and Ultimate Visual Studio versions) [1, 2]. It presents the well know recording tool to get automated testing but other procedure can be follow to save efforts and improve the maintenance in large automated testing projects. It follows the Add a new control to the UIMap tool. In the next a set of points to get UI Controls with this tool are presented:

  1. The first step is to create a Coded UI Test solution in Visual Studio
  2. In the created solution go to uitest (right button) and Edit With Coded UI Test Builder

1

  1. Here, it is show the two principal tools to work with Visual Studio in automated testing:
    1. Recording tool marked with A in the next screenshot.
    2. Add a new control to the UIMap tool marked in B in the next screenshot. As commented, the strategy presented here is based on get UI Controls with this second. To work with it you must apply it on the desired control in the UI of the application or web.

2

  1. Next add the captured data to the UI Control Map by means of To Add a new control to the UI Map marked with C in the next screenshot. Use the option copy to clipboard (D in the screenshot) to get the text of the UI Control and apply it in the code later.

3

  1. In UIMAP.uitest go to UI Control Map where the details of the UI control are shown.

4

A last comment, the name of the stored UI Control can be changed. As the number of stored UI Controls is increased the difficulties to understand the meaning  of them increases. Therefore it is a best practice to rename UI Controls in function of its content.

[1] https://msdn.microsoft.com/en-us/library/dd286726.aspx#VerifyingCodeUsingCUITGenerateAssertions

[2] https://msdn.microsoft.com/en-us/library/dd380782.aspx

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s