Extended Find mechanism of NameMapping in TestComplete
To illustrate the above problem, lets take a scenario of an application which contains dock panel and the test require to undock the panel and then perform some operation on it. When we undock a dock panel some of the intermediate containers might get deleted or some more gets created. For example, in the default layout of panel in an application, the fully-qualified name of a panel object may be as follows:
Sys.Process("AutomatedApp").Window("PanelClass", "Window Caption").Window("ContainerClass", "", 1).Window("PanelClass", "Panel Caption")
And when the panel is undocked, the object hierarchy looks like:
Sys.Process("AutomatedApp").Window("FloatingContainerClass").Window("PanelClass", "Panel Caption")
As we can see ,the hierarchy structure of the panel changes dynamically,i.e the intermediate containers are getting added or deleted.Due to this issue the NameMapping created for one layout cannot be used in the other layout.One way of getting rid of this issue is that we create the different NameMapping for the different layouts but it will make object dependent on the layout.To overcome this problem NameMapping provides the concept of Extended Find criteria.
When Extended Find Method is enabled ,we can omit the parent hierarchy of the object to some level and map the object to the parent node whose properties and value remain constant throughout. When the script is executed with this method enabled, this setting instructs TestComplete to find the mapped object in the descendant hierarchy of the mapped parent object instead of the direct child object.
In the above example, we can the change the hierarchy and make the Window(“PanelClass”, “Panel Caption”) child object of the Process(“AutomatedApp”) object. By doing so we have moved the child object to a stable object eliminating all the variable objects in between.
The steps that needs to follow to use this particular method:
1.First we need to enable this method.For the same follow the steps as given below.
- Right click any where in Name Mapping window and select the “Field Chooser” option from the context menu.
- Drag the “Extended Find” option from the Field Chooser and drop the same in Name Mapping window
- Close the Field Chooser window
2.Select and drag the object in Name Mapping whose parent hierarchy changes dynamically on run time and drop it below the stable object.
3.Click on the Extended Find Method check box which appears adjacent to the object.
This method is time consuming method as TestComplete search for the mapped object in all the descendant nodes of it.
Note : If you want to disable this setting simply uncheck the box adjacent to the mapped object in Name Mapping window and update the object hierarchy manually using the “Map Object” option that appear in Tools toolbar.
Apart from this method we have Find and FindAll method in TestComplete. Find more details in the last post Object Identification in TestComplete – Descriptive Way.