Coded UI Testing with more than one UIMap.Designer.cs?

南笙酒味 提交于 2019-12-11 02:34:10

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/18611472/coded-ui-testing-with-more-than-one-uimap-designer-cs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!