Intro
This is part 3 in a series of posts on creating and maintaining Coded UI tests with Multiple UI maps. My intent here is to give a little more detail to help those new to Visual Studio.
Part 1: Creating a new Coded UI solution
Part 2: Adding a New UI Map
Part 3: Modifying an Existing Coded UI Map
Part 4: Adding a UI Map to the TestRunUtility
Part 5: Assembling the test
Part 6: Changing Recorded Methods
Part 7: Deleting actions when recording with the Coded UI Test Builder
Part 8: Modifying Generated Code
This technique is an extension of the technique found in the following links by Anu , a Program Manager in the Visual Studio ALM Test Tools group and the MDSN documentation. http://blogs.msdn.com/b/anutthara/archive/2010/02/08/scaling-up-your-cuit-ui-automation-for-real-world-projects.aspx
http://blogs.msdn.com/b/anutthara/archive/2010/02/10/walkthrough-using-multiple-coded-ui-maps-in-test-automation.aspx
http://msdn.microsoft.com/en-us/library/ff398056.aspx
In our last post, we decided we needed to record the closing of the browser and that action belonged in our home page map. We already created the HomePageMap so we now need to modify it to add another action.
In solution explorer, right click on the HomePageMap.uitest and select ?Edit with Coded UI Test Builder?.

The Coded ui Test builder is launched (Note: this is one of many actions that will cause the <PageName>.designer.cs to be regenerated.
Without recording, navigate to the home page.
Start Recording -> close the browser -> Click Generate Code -> Enter CloseBrowser for the name -> Click Add and Generate -> Close the Coded UI test Builder.
That is all there is to it.
What we have at this point is a bunch of disconnected actions and an assertion. Now we need to put it all together and this is where the Multiple UI map technique comes into play. We could reference and call each of these maps individually and successfully test this scenario without a problem. The weakness in doing that is that we have quite a bit of duplicate code in our generated UI maps. Specifically if you do a file search for ?Home - Tailspin Toys? you will see we are using it in each of our generated maps. In my next post I will add some code and something called the TestRunUtility so we can start tying all of these UI maps together.