Share via


Coded UI testing and managing UIMap files with recorded tests from Test Manager

As a best practice I like to use multiple UIMap files to better manage my Coded UI tests. Recently I have been creating Coded UI tests using existing action recordings from Test Manager. The problem is that when you use those existing recordings it automatically generates them into the default UIMap.uitest file. This obviously conflicts the best practice. Here are some steps that you can take to work around this.

1) First create your Coded UI Test file and name it accordingly. When the popup appears select the "Use an existing action recording".

2) Visual Studio now creates a UIMap.uitest file (or uses the existing one) and generates the UI Actions from the existing recording.

3) Copy the UIMap.uitest file and paste it into your UIMaps folder or location of choice.

4) Rename the file to something meaningful. In this case I am calling in "UIMapSample.uitest".

5) Open the UIMapSample.cs file and rename the partial class using Refactor > Rename.

6) Check to make sure the UIMapSample.Designer.cs file and partial class have been renamed

7) Check to make sure the UIMap property in your Coded UI Test is not referencing the new UIMapSample class.

8) Delete the UIMap.uitest file

9) Run your test

It requires a few extra steps but it gets the job done. Happy Coded UI testing.