The Name Mapping repository stores all your tested objects with identification criteria that TestComplete uses to find the objects in applications. By default, TestComplete uses one or more property-value pairs to identify the objects:
Note: Identifying objects by a collection of property-value pairs is supported for desktop applications and mobile applications running on devices connected to TestComplete locally. To identify objects in web applications and mobile applications running in device clouds, selectors are used. See Name Mapping - Selectors.
Usually, when mapping objects, TestComplete tries to choose the properties that will identify the objects in the application uniquely. However, there can be situations where you may want to add extra properties to the identification criteria or to remove unnecessary properties. You can also change the property values, for example, to match changes in your tested application.
Adding identification properties
Before adding identification properties to a mapped object, make sure your tested application is running and the object currently exists in it.
-
Locate the object in the Name Mapping repository.
-
Double-click the object. TestComplete will open the Edit Name Mapping Item dialog that lists all the properties used to identify the object:
-
In the Available list on the right, select the property you want to add and click .
You can set a property value using:
-
Wildcards (* and ?).
-
A regular expression (precede the expression with the
regexp:
prefix, for example,regexp:List[\w+]
).
To add a nested property (for example,
NativeClrObject.Name
):-
Select the first item (in our example -
NativeClrObject
) in the Available list on the right and click the ellipsis button in the property value cell. -
Select the second item (in our example -
Name
) and click .
-
-
Add more properties, if needed.
-
Click OK.
It may take a lot of time for TestComplete to retrieve some property values (for instance, the VisibleOnScreen
property). Using such properties as a name mapping criterion may affect your test performance, especially if you use them when performing an extended search. We do not recommend that you use such properties when mapping objects.
Removing identification properties
-
Select an object in the Name Mapping repository. You will see the object’s identification properties on the right.
-
Right-click the property you want to delete and then click Delete.
Modifying property values
-
Select an object in the Name Mapping repository. It will show the identification properties on the right.
-
Select a property, press F2 and then click the ellipsis button in the property value cell. The Edit Property Value dialog will appear:
-
In the dialog, specify a new property value:
To use a constant value:
-
Select Constant from the Mode drop-down list.
-
Enter the property value in the Value text box.
Tip: You can use wildcards (* and ?) or regular expressions to mask the dynamic parts of string values. For example, instead of Afx:TabWnd:3f9f0000:8:10005:10, use Afx:TabWnd:*.
To use a project variable as the property value:
-
Select Project Variable from the Mode drop-down list.
Note: For project or project suite variables of the String, Integer, Boolean, and Double type, the list shows the current variable value making the choice easier.
-
Select a variable from the Type list. The variable value will be shown in the Value box.
Note: Only String, Integer, Double and Boolean variables can be used as identification property values.
TestComplete caches mapped objects. If the variable value is updated during the test run, TestComplete may not update the mapped object’s criteria, and your test will continue using the cached object. To avoid possible issues, add the
RefreshMappingInfo
method to your test to command TestComplete to clear the cache and search for the object with the updated mapping criteria. -
-
Click OK.
See Also
Name Mapping
Name Mapping
Name Mapping - Conditional Mapping Criteria