Timing of Control "Instantiation"
description
I am working my way through automation using CodedUITest (and considering CUITe as an alternative).
The application I am working with is a WPF application.
My goal is to separate the details of the testing from the code.
I succeeded in creating a prototype (working off of spreadsheets) but I notice some 'weird' behavior while the automation activity commences.
One of the things I am baffled by is the timing of a control being instantiated, especially when the control is deep in the hierarchy of UI scaffolding, panels, tabs, etc.
From the code generated by the CodedUITest recorder it seems that until the particular control of interest is either being queried (Assert...) or activated (Click, etc.) there is only setting of the parent, search criteria, search configuration and window titles but no actual 'instantiation' of the control.
When is the control actually instantiated (beyond the new xxxx())?
Is it a mistake to issue a control.Find() on any of the intermediate objects in the hierarchy preceding the control?
Is it a 'waste' of an operation to do Find() followed by Click() or Assert?
As, in my paradigm, i issue a Find() on every control down the hierarchy, the strange behavior of the UI that I notice (scrolling down that i cannot account for, etc.) leads me to wonder whether this is due to using Find() on intermediate controls.
Much appreciated.