Name Mapping Templates

Applies to TestComplete 12.60, last modified on September 17, 2018

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:

Name mapping templates

Click the image to enlarge it.

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:

  1. Open the Name Mapping repository.

  2. 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

  1. Open the Name Mapping repository.

  2. Right-click somewhere within the Mapped Objects or Aliases tree and select Add Template from the context menu.

  3. The Add Template dialog opens. In the dialog:

    1. 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:

      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.

    2. Click Add. The Add Name Mapping Template dialog opens.

    3. In the dialog:

      Define a new template
      1. Specify the template name and category.

      2. 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.

      3. 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 and MappedName properties in name mapping templates.

      4. 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.
  4. Click OK to close the Add Name Mapping Template dialog.

When mapping objects

  1. Start mapping an object. For more information on how to map objects manually, see Mapping Objects Manually.

  2. In the Object Name Mapping dialog, click Templates.

  3. TestComplete will show the Edit Name Mapping Templates dialog that lists all the templates that match the object being mapped.

  4. Click Add. The Add Name Mapping Template dialog opens.

  5. In the dialog:

    Define a new template
    1. Specify the template name and category.

    2. 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.

    3. 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 and MappedName properties in name mapping templates.

    4. 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.
  6. Click Close to close the Edit Name Mapping Templates dialog and resume mapping the object.

Edit a template

  1. Open the Name Mapping repository.

  2. Right-click somewhere within the Mapped Objects or Aliases tree and select Templates from the context menu. The Name Mapping Templates dialog opens.

  3. Select the template that you want to modify and click Edit. The Edit Name Mapping Template dialog opens.

  4. 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.

  5. After you have made the required changes, click OK to close the Edit Name Mapping Template dialog and apply the changes.

  6. Click OK to close the Name Mapping Templates dialog.

Delete a template

  1. Open the Name Mapping repository.

  2. Right-click somewhere within the Mapped Objects or Aliases tree and select Templates from the context menu. The Name Mapping Templates dialog opens.

  3. Select the template to delete and click Remove.

  4. 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

Highlight search results