This section describes how you can create stable locators that enable Silk4NET to reliably recognize the controls in your application under test (AUT).
Silk4NET relies on the identifiers that the AUT exposes for its UI controls and is very flexible and powerful in regards to identifying UI controls. Silk4NET can use any declared properties for any UI control class and can also create locators by using the hierarchy of UI controls. From the hierarchy, Silk4NET chooses the most appropriate items and properties to identify each UI control.
Silk4NET can exclude dynamic numbers of controls along the UI control hierarchy, which makes the object recognition in Silk4NET very robust against changes in the AUT. Intermediate grouping controls that change the hierarchy of the UI control tree, like formatting elements in Web pages, can be excluded from the object recognition.
Some UI controls do not expose meaningful properties, based on which they can be identified uniquely. Applications which include such controls are described as applications with bad testability. Hierarchies, and especially dynamic hierarchies, provide a good means to create unique locators for such applications. Applications with good testability should always provide a simple mechanism to identify UI controls uniquely.
One of the simplest and most effective practices to make your AUT easier to test is to introduce stable identifiers for controls and to expose these stable identifiers through the existing interfaces of the application.