0 Shares 1813 Views 2 Comments

Name Mapping & Aliases

Mar 25, 2013
1813 Views 2

NameMappingName Mapping is the most important and exciting feature of test complete, Using this feature you can create a mapped name using the properties of the object in our application, which can then used to refer the object in the scripts. You must be wondering like, why we need this name mapping when TestComplete already lets us identify an object uniquely by object name format. Well… the problem is, object name depends on the object properties which is not consistent and can change from one application to another. Another problem is, the object names are quite long and not easily readable. At the same time it is very confusing to get the context of a particular statement.

Applications in the Windows system, subordinate to the application form, form controls are objects, each object has a unique identifier , they work together to build a huge object tree, the root node is Sys, can imagine a decked out hexadecimal number of the leaves of the tree, every leaf Properties Methods Events decorate it, if the recorded code hexadecimal numbers do object name all will collapse, so we must first of these objects a name, the most simple ideas is to use this object similar to the caption, index and classname attributes to a name, so TestComplete memory each object from the name, in order to clearly show the hierarchical relationship of the individual objects, use the fullname to identify. The Full Name looks probably like this:

Referring objects here is little dizzy, isn’t it …? , its very long and is not easy to write and read. To Solve this issue, TestComplete provides Name Mapping using which we can refer objects  and unique names. The statement will become readable.

Using the selected properties, Test Complete identifies the object using the properties and assigns a Mapped name to that object.

While creating a mapped name you need to provide a reasonable name for mapped name and select few unique identifiers for the object.

After creating Name Mapping for every object, we can refer to the object as follows.

It’s clear that this is easier to read. Even though it is easy to read, still the name is too long. It will be difficult to remember all the Mapped names and their hierarchy. So you end up getting the full mapped name of the object by using the object spy. As a result productivity goes down because you have to go through several steps to pick out the name.

To resolve this problem, we can use Alias names. From the above mentioned mapped name, we can remove a few objects and create a short name. For example the Aliases name of the above object can be given as follows.

This becomes very easy to read and write. Also we can easily memorize the names of required objects alone and type them in our scripts (without the help of the object spy).

To Map an object

Click on ‘Map Object From Screen’ button in TestComplete toolbar. alternatively you can select map object from Object browser right click menu.

 tc_NP_MapButton

 

This opens Map Object window. Drag the Finder tool to the Object you want to add and release the mouse button. Click OK Once done.

 tc_NM_MapObject

In the next screen it asks to map all the parent objects. Click Yes.

tc-nm_mapall

Map all the required objects with a readable and clear name until you get your object.

tc_nm_add details

When all the object is mapped open Name Mapping Item. this reveals the name mapping which you just created. You can see the Mapped Objects in a tree format. You will also see the Alias names which are created by default (in the same hierarchy as the Name Mapping).

tc_nm_bothsame

If you use this default Aliases name, it will come to the same length as Full Mapped name. Remove the names of some unwanted higher level objects by dragging the objects into aliases under the required object hierarchy.

tc_nm_draggedinaliases

 

You may be interested

Setting up Mobile Automation Project in Windows
Katalon Studio
77 views
Katalon Studio
77 views

Setting up Mobile Automation Project in Windows

Saket - Sep 20, 2017

This tutorial explains how to setup a mobile automation project and test a mobile app using Katalon Studio on Windows. This tutorial assumes that you are familiar…

Katalon Studio GUI Overview
Katalon Studio
147 views2
Katalon Studio
147 views2

Katalon Studio GUI Overview

Saket - Sep 14, 2017

GUI Overview After installing and setting up Katalon Studio for your automated test, you must understand the GUI. In this post we will walk you through the…

LeanFT Tutorial #4: Application Model Overview
LeanFT
125 views1
LeanFT
125 views1

LeanFT Tutorial #4: Application Model Overview

Saket - Sep 10, 2017

In this post we are going to focus on Application Model in LeanFT. Refer our earlier posts on LeanFT Getting Ready with LeanFT Browser Extensions and Settings…

2 Comments

  1. Pingback: Automated -360 | Create your first test with TestComplete

  2. Pingback: Extended Find mechanism of NameMapping in TestComplete - Automated360

Leave a Comment

Your email address will not be published.

Most from this category

Join The Growing Group of 15000+ Test Automation Engineers

Signup for our newsletter and get access to free downloads, as well as tips, tricks and techniques and various test automation resources.
Name
Email Address
Secure and Spam free...