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: When testing web applications, you can configure your project in one of the following ways:
-
Use custom attributes as additional mapping criteria when mapping the objects automatically. See Using Custom Attributes as Name Mapping Criteria for Web Testing.
-
Use XPath expressions and CSS selectors as mapping criteria instead of those property-value pairs. See XPath Expressions and CSS 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.
-
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.
-
-
Click OK.