2

I started with Coded UI Tests. So far so good, but I have one concern about the file UIMap.uitest. Since I have to create many test scenarios, means many cs files. The more files I have, the bigger the UIMap.uitest is, because it keeps regenerating the code all the time. My question is that it's possible to have/create each UIMap.uitest for each cs file, respectively? I am using VS2010.

Thanks

Ragnarsson
  • 1,715
  • 7
  • 41
  • 74

1 Answers1

5

Yes. Look for information on "multiple ui maps". The general approach is to right-click in solution explorer, add a new item that is a "Coded UI test map" (Add => New item => Visual C# items (or possibly VB) => Test => Coded UI test map). After naming the map and clicking OK the normal Coded UI dialogues should appear allowing recording and generating of new items. Some people recommend creating a folder in solution explorer to contain all the UI maps. After recording and generating code, calls of the generated methods will need to be added manually to the test methods. Additionally, these new UI maps will need to be instantiated. This Microsoft blog has some more details http://blogs.msdn.com/b/anutthara/archive/2010/02/10/walkthrough-using-multiple-coded-ui-maps-in-test-automation.aspx

When using multiple UI maps DO NOT right click in the source files and select the "Generate code for Coded UI test". If you do then the code will be added to the default "UImap.uitest" file, creating one if needed and with no warning that it is doing so. (See also http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3378897-choosing-the-uimap-when-recording-tests )

I have not found any way of moving items from one UI map file to another except by editing their XML sources and that is complicated.

AdrianHHH
  • 13,492
  • 16
  • 50
  • 87
  • 2
    Our best practice is to have a separate UIMap for each page/form of our application to keep the controls distinct. Exception would be for Common/General/Generic controls that might be used across multiple pages, like a menu, common header/footer controls. – yonitdm Sep 04 '13 at 15:56