Ask a Question

Issue in name mapping

Occasional Contributor

Issue in name mapping


Using the object spy , I got a mapped name for an object. Say for example the mapped name looks like

I ran the test cases using this mapped name it all worked fine.

Now after couple of days if I run it now it failed because the mapped name got changed . It got changed to like


This has happened for couple of objects over a period of time. I raised this concern with my team and asked the developers if they have changed any of these objects. They confirmed that they didn't touch any of these objects.


Can someone help me find out the reason as to why the mapped name gets changed for some of the objects ?


I need to find a way to stop this , as this affects my test results

Community Hero

While the devs may not have explicitly changed anything in code, the properties of the object are likely dynamic and there is an issue with what you're using to identify the object.


As for the alias itself changing, this is probably because you have automatically map objects turned which is creating a new mapping because the dynamic property has changed.


Can you provide more info about what properties you are using to identify the objects in your name mapping, and what the difference is from the first and second mapping? Without any other info any furthers attempts to debugs this would be shots in the dark. 


Click the Accept as Solution button if my answer has helped
Valued Contributor

I also agree with @cunderw to add more...

auto-mapping is not a good practice to develop large scale test suits. (good for beginners )

it will create a mess up in mapping you would not be able to clean up later, remember when your suite grows name mappings also will grow.


If it's a dynamic object you can use dynamic mappings techniques like using wild cards ...Link.... and extended find in mapping 


It is advisable always do mapping manually so you can carefully select and map  

Esteemed Contributor

OR... if you're going to use automapping (because it is a good shortcut to get items mapped quickly), please, please PLEASE go back and edit what was mapped.  Look for dynamic properties, close the application and re-open it to see if the objects STAY mapped, adjust properties, property values, etc., to be more robust.  And for goodness sack, clean up your Aliases... no more




Make it "nice"



Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Occasional Contributor

Thanks for the replies.


You have mentioned about auto-mapping. I am not sure what that is. I can explain how i did mapping here.


I used the object spy and select the desired object , then use "Highlight the object in object tree" option. Once am able to view the object in object browser , i right click on the object and get the mapped name (it has the alias ) .  I use this mapped name in my code. Assign a variable to the mapped name and use that vairable.

I am doing this for mapping all the objects. I have run tests for close to 6 months using these mapped name ( variable).  95%-97% of the mapped name dont change. Its working fine. The remaining % changes for some reason which I dont know.

So that's most like exactly what is causing you're issue here. 


What's happening is something your app is changing a property that is being used by your name mapping to identify the object. Most likely some kind of ID or Index. By having automatic name mapping turned on Test Complete made its best guess at properties to use for identification, which as @tristaanogre mentioned is a good start, but should always be manually adjusted no only from an identification standpoint, but also from an organization standpoint. 


Can you post screen shots of the name mapping properties for the original and so we can compare what changed? Then we can determine what needs to change on your end to account for changes to your application.


Thinks about this way, say your object is mapped with a class of myWindow and an Index of 1. You get a new version of your application and and that window has the same class, but is now not the first window in your application so it's Index changed to 2. Well now your tests are failing because it's looking for Index 1 still. So in that situation you would probably just want to remove Index as one of your identification properties and just look for the window's class. Not saying this is exactly what's going on, as without the screenshots list above I'm shooting in the dark here. But I bet it's something very similar. 


Besides that I highly recommend reading every last word in this section:


A good understanding of what name mapping is, aliases are and how they are used to find objects is paramount to creating solid and stable automated test. Otherwise you're just playing a guessing game with your application. 



Click the Accept as Solution button if my answer has helped
Occasional Contributor

Thanks for the reply. 


In my previous post I have mentioned the steps I follow to map objects. Is that not the correct way of mapping objects?


Please find below the sample of the issue i faced :



The Line 1 was mapped intially. I was using it in code and it was working fine for couple of months (for few application releases)

Then one day one of my test failed. Then when checked the object it has been modified to as mentioned in Line 2



Once again as it has been said previously by others: your NameMapping uses identification properties that sometimes change their values thus breaking the identification. You must compare initial and newly created mapping, figure-out what was changed, whether the change was caused by developers or by runtime environment and correct your NameMapping to either use new value or to replace unstable identification parameter with the stable one.

As it also has been said, TestComplete tries to make its best guess while doing automatic NameMapping but this might not always work and manual verification and adjustment (if needed) is a good recommended practice.

For example, you may have a web browser mapped using its name (e.g. chrome) and index (e.g. 1). This will work while you have one Chrome browser running but will fail when another instance of Chrome will be started because this will change the value of Index from 1 to 2.

Your case is likewise - some identification property for ScrollViewer has changed. Find what and why was changed and correct the NameMapping to not use unstable properties for identification.


And, in addition to all links to the documentation already mentioned, webinar might also appear to be useful.

  /Alex [Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
Showing results for 
Search instead for 
Did you mean: