TestComplete Tutorial 19 - Adding Objects to the Name Mapping Repository

You can add objects to the Name Mapping repository in several ways:

  • Automatically when recording and editing tests.

  • Manually from the screen or from the Object Browser.

  • From scripts.

Mapping Objects Automatically

By default, TestComplete adds objects to the Name Mapping repository automatically when you –
  • Record tests,

  • Create checkpoints,

  • Add or edit keyword test operations.

This behavior is controlled by the Engines > Name Mapping > Map object names automatically option of TestComplete:


If you do not use the Name Mapping repository in your project, you can disable this option to prevent TestComplete from mapping objects.

To enable or disable automatic name mapping
  1. Select Tools > Options from the TestComplete main menu. This will open the Options dialog.

  2. Select the Engines > Name Mapping category.

  3. Select or clear the Map object names automatically check box.

  4. Click OK to save the changes.

Notes - 
  • Mapping objects automatically during the test recording is the easiest and fastest way to map multiple objects.

  • TestComplete can store information on the properties and methods of mapped objects to the Name Mapping repository. This way, you will be able to view the properties and methods of mapped objects in test editors even if your tested application is not running. 
  • TestComplete can capture images of mapped objects. This helps you understand to which UI element of your tested application the mapped object corresponds. 
Mapping Objects Manually

To map a single object -
  • Run your application and make sure the needed window or control is on the screen or can be invoked quickly.
  • Do one of the following:
    • In the Object Browser or in a Visualizer frame, right-click an object and select Map Object from the context menu.
    • OR Click  Add Object on the Tools toolbar or on the toolbar of the Name Mapping editor.
    • Use the  target glyph or the “point and fix” mode to select an object on screen or in the Mobile Screen window (for mobile applications).
  • If your project does not have the NameMapping item yet, TestComplete prompts you to add it.
  • In the resulting dialog, choose if you want to map the object with the default alias and identification properties automatically or if you want to specify them manually:


For each object being added to the Name Mapping repository:

  • If there are several name mapping templates that match this object, TestComplete prompts you to select the template to use.

  • TestComplete displays the Object Name Mapping dialog where you can enter the object alias and select the identification properties.

To batch-map child objects -
  1. Do one of the following:

    • In the Name Mapping editor, right-click the parent object in the Mapped Objects tree and select Map Child Objects from the context menu.

    • In the Object Browser, right-click the parent object and select Map Child Objects from the context menu.

  2. In the dialog, select the check boxes next to the child objects you want to map.

To map all the objects automatically using the default aliases and identification properties, select the Map objects automatically check box and click OK.

To specify the object aliases and identification properties manually, leave the Map objects automatically check box unchecked, click OK and follow the on-screen instructions.

Mapping From scripts

Requirements
  • The object you want to map must exist in the system.

  • The parent object of the object you want to map must be already mapped.

  • To map an object from tests, use the Mapped_Object.AddNamedChild method. This method is available for all the mapped objects to which you refer by their alias or by a mapped name.

For each object you are mapping, you can specify the following:
  • A mapped name to assign to the object.
  • The properties and values to use to map the object.
  • Whether to store information on the properties and methods of the mapped object. This way, you will be able to view the object’s properties and methods in test editors even if the tested application is not running.
  • An object description.

    Comments

    Popular posts from this blog

    TestComplete Tutorial 6 - Object Identification in TestComplete

    TestComplete Tutorial 1 - Introduction to TestComplete Automation Tool