About
By default, when adding objects to the Name Mapping repository, TestComplete tries to select the properties that will identify the objects uniquely. You can specify which properties TestComplete should use for various object types by creating name mapping templates:
A template means something like this:
“If an object has the ClrClassName
property (that is, it is a .NET object), map this object using the ClrFullClassName
and NativeClrObject.Name
properties.”
Each name mapping template consists of:
-
A condition - A set of properties and values used to match objects with this template. Conditions should cover object types (.NET combo box, Java list box, Android calendar) rather than individual objects.
-
Identification properties that TestComplete will use to map objects matching the conditions.
Templates are project-specific. That is, for each test project, you can create a set of unique name mapping templates.
How templates work
When an object is added to the Name Mapping repository, TestComplete checks whether there is a matching template for this object. Depending on whether there are matching templates, TestComplete maps the object as follows:
Number of matching templates | The object is mapped using |
---|---|
none | Default identification properties. |
one | Identification properties defined in this template. |
several (two or more) | An arbitrary template. If you choose to manually configure identification properties during the mapping, you can select a specific template to use. |
View templates
You can view and manage name mapping templates in the Name Mapping editor:
-
Open the Name Mapping repository.
-
Right-click somewhere within the Mapped Objects or Aliases tree and then click Templates. The Name Mapping Templates dialog opens, listing all name mapping templates defined.
Create a template
By default, your project does not have predefined name mapping templates. You can create them manually:
In Name Mapping editor
-
Open the Name Mapping repository.
-
Right-click somewhere within the Mapped Objects or Aliases tree and select Add Template from the context menu.
-
The Add Template dialog opens. In the dialog:
-
Select the object, for which you want to create a template, on the screen or on the Mobile Screen.
Note for mobile testing: The device and application must be prepared for testing. You can do this in one of the following ways:
-
Pick the object with the target glyph
Drag the target glyph to the desired onscreen object and drop it once a red frame appears around the object.
To select an object in a mobile application, drag the target glyph to the desired object on the Mobile Screen (see Select an Object on the Mobile Screen).
-
Point to the object and fix
Click the button, and then move the mouse pointer to the desired onscreen object. When a red frame appears around the object, press the Select object shortcut, Shift+Ctrl+A. (The shortcut can be changed in the Global Shortcuts options.)
To select an object in a mobile application, move the mouse pointer over the desired object on the Mobile Screen (see Select an Object on the Mobile Screen).
The name of the object you selected is displayed in the Object box, and the dialog shows a list of existing name mapping templates corresponding to this object.
To make sure you have selected the correct object, click Highlight and TestComplete will indicate the object on screen with a flashing red frame.
-
-
Click Add. The Add Name Mapping Template dialog opens.
-
In the dialog:
-
Specify the template name and category.
-
Select the Active check box for the properties that will be used to compare the object with a template. TestComplete will use them to find a relevant template for the object being mapped.
-
Select the Store check box for the properties the template will use as the default identification properties for matching objects.
Do not use the
Name
,FullName
andMappedName
properties in name mapping templates. -
Click OK to close the Add Name Mapping Template dialog and create the new template.
Note: By default, the dialog shows only the object’s basic properties. To use nested properties (for example, NativeClrObject.Name
), you can add them to the list manually. To learn how to do that, see the dialog description. -
-
-
Click OK to close the Add Name Mapping Template dialog.
When mapping objects
-
Start mapping an object. For more information on how to map objects manually, see Mapping Objects Manually.
-
In the Object Name Mapping dialog, click Templates.
-
TestComplete will show the Edit Name Mapping Templates dialog that lists all the templates that match the object being mapped.
-
Click Add. The Add Name Mapping Template dialog opens.
-
In the dialog:
-
Specify the template name and category.
-
Select the Active check box for the properties that will be used to compare the object with a template. TestComplete will use them to find a relevant template for the object being mapped.
-
Select the Store check box for the properties the template will use as the default identification properties for matching objects.
Do not use the
Name
,FullName
andMappedName
properties in name mapping templates. -
Click OK to close the Add Name Mapping Template dialog and create the new template.
Note: By default, the dialog shows only the object’s basic properties. To use nested properties (for example, NativeClrObject.Name
), you can add them to the list manually. To learn how to do that, see the dialog description. -
-
Click Close to close the Edit Name Mapping Templates dialog and resume mapping the object.
Edit a template
-
Open the Name Mapping repository.
-
Right-click somewhere within the Mapped Objects or Aliases tree and select Templates from the context menu. The Name Mapping Templates dialog opens.
-
Select the template that you want to modify and click Edit. The Edit Name Mapping Template dialog opens.
-
Change the template name and category, the object type that the template matches and the default set of identification properties for that object type as needed.
-
After you have made the required changes, click OK to close the Edit Name Mapping Template dialog and apply the changes.
-
Click OK to close the Name Mapping Templates dialog.
Delete a template
-
Open the Name Mapping repository.
-
Right-click somewhere within the Mapped Objects or Aliases tree and select Templates from the context menu. The Name Mapping Templates dialog opens.
-
Select the template to delete and click Remove.
-
Click OK to close the dialog.
Notes
You can save and load name mapping templates from a file. For more information, see Exporting and Importing Custom User Settings.
See Also
Name Mapping
About Name Mapping
Adding Objects to the Name Mapping Repository