0

Is it possible to add all controls in a view to the automatically generated UIMap?

I am writing a test to check if a control in a form has focus. The function that is beeing tested sets control.focus() if the control actually exists in this view. The function can open several different forms, based on the string value passed to the function, and I therefore want to check if I am beeing sent to the form that actually contains this control. The control can be anything from a dropdown-menu to an edit-box.

I am using VisualStudio 2013 RC to create this Coded UI Test from a testCase created in Test Manager 2013.

Nemeas
  • 1
  • 1
    If you were to add all the controls you would need to write test code to access all of them. That would need lots of code and may be difficult to manage when the application changes. A possible alternative is to only have the top level item in the UI Map and then to do a recursive descent though the controls using the `GetChildren` method. – AdrianHHH Oct 09 '13 at 11:42
  • 1
    Yeah, that's what i thought. But I just found out that I don't actually need to add all Controls to the UIMap to find the control I'm looking for: `Dim ctrl As New UITestControl(winForm)` `ctrl.SearchProperties.Add(New PropertyExpression(UITestControl.PropertyNames.Name,parameter.Trim,PropertyExpressionOperator.Contains))` `Dim controls As UITestControlCollection = ctrl.FindMatchingControls()` This way I get the controls with the properties defined in the SearchProperties even if they are not defined in the UIMap. – Nemeas Oct 10 '13 at 06:34

0 Answers0