I'm using Visual Studio Premium 2012 to create automated UI unit tests for my .Net application. On click of a Submit button on one of the pages, a pop-up window opens. I'm able to add assert conditions by focussing on the popup window. However, the challenge I have is - my UI tests are failing at the point where I added assert conditions for the popup window. It is always trying to match the popup window assert search properties in the main window itself and failing. Error message says expected value doesn't match with actual value. What should I do to correctly locate the popup window?
1 Answers
Generally speaking you need to add additional SearchProperties or FilterProperties to the controls in the UI Map so that the correct control can be identified. Look for some feature of the outermost control of the popup window that differs from that of the main window. Ideally the two should have different titles and I would have expected that to be sufficient to distinguish them.
Try using the cross hairs tool to explore the properties of the popup window and of the main window. Adjacent to the "Add assertion" button there are four small arrows (up, down, left and right). Use these arrows to find the top level controls of the two windows and then view their properties.
Without access to the application and the code of the Coded UI test it is very difficult to be precise about what exactly you need to do.
Update
Check the SearchProperties and FilterProperties recorded for both windows (either look in the uimap.designer.cs file or view the properties of the two windows and click the collections ellipses). There should be differences to allow Coded UI to find one or the other window. You may need to add more search or filter properties. Have a look the properties shown by the cross hairs tool to see what items are available to distinguish the two windows. Based on the text in your comment, you might find that the URI can be added, possibly using the contains comparator rather than equality.