The Name Mapping repository stores information on the object location in the application’s object hierarchy and uses it to find the objects during the test run. You can configure your Name Mapping repository to search for an object on all levels down the hierarchy rather than just on the current level.
In dynamic applications, the same object can be at various positions in the object hierarchy depending on the application state:
To identify such “roaming” objects, configure TestComplete to ignore their dynamic parents. To do this, map a “roaming” object (in the example above it is Panel("Dock1")) to the closest non-dynamic parent object (Table(0) or Panel("BackgroundZone")) using Extended Find.
Sometimes, a mapped object has no unique properties. For example, the DIV and TABLE elements used to lay out web pages are often identified only by indexes, and these indexes can be dynamic.
You can exclude non-unique parent objects from Name Mapping to make child object identification more robust. You need to turn on Extended Find for each object whose direct parent object is not included in Name Mapping.
By default, when mapping objects, TestComplete tries to use extended search where it is possible. To control this, use the Engines > Name Mapping > Use extended find when possible option.
In the Name Mapping editor, locate the object in the Mapped Objects tree.
If the Extended Find column is hidden in the tree, make it visible:
Right-click anywhere in the tree and then click Field Chooser.
Drag the Extended Find column from the resulting Customization window to the editor.
Drag the object to the closest non-dynamic parent object:
Select the Extended Find check box for the object:
If a confirmation dialog appears, click Yes.
If needed, in the Aliases tree, update the object’s alias to match the changes in the Mapped Objects hierarchy.
|Note:||The hierarchy of mapped objects and aliases must not contradict the parent-child relationships of the corresponding objects in the application.|
If needed, delete unneeded intermediate objects from the Mapped Objects and Aliases trees.
Update the object name in your tests after you change the Name Mapping structure. In keyword tests, TestComplete will suggest to update the name automatically. In script tests, update the name manually.
To search for objects in tests, you can use:
In keyword tests - The Find Object operation.
In this case, you specify the identification properties and values directly in your test. In addition, you can limit the search depth to make the search faster.
For more information on using the search methods, see these topics:
Extended Find searches down the entire object hierarchy. The search is not depth-limited.
Extended Find uses breadth-first search, regardless of the value specified in the Object search strategy project property (it affects the
Find methods only).
Searching for objects in large applications may take a long time. If you get warnings in the test log that a search takes too much time, try doing the following:
Add more objects to the object’s parent hierarchy in the Mapped Objects tree to narrow the search. For instructions, see About the 'Search for a Mapped Object Took Too Much Time' Warning.
Increase the project’s Auto-wait timeout.
NameMapping.TimeOutWarning property to false. This will stop TestComplete from posting warning messages to the log if the search takes too long.