Forum Discussion

darshanyshah's avatar
darshanyshah
Occasional Contributor
11 years ago

Name Mapping Help !!!!

Hi,



I am trying to map a WPFObject on my appilication. But the extension/ name keeps on changing.



ex:Aliases["Agilent_OpenLab_DataAnalysis"]["HwndSource_ShellWindow"]["ShellWindow"]["WPFObject"]("XamTabControl", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("ItemsControl", "", 1)["WPFObject"]("Ae031149ca32f1a4cfdaad96ac35e52391d1c")["WPFObject"]("A2dc60d5eab350a4164ab245a408afe0d9bc8")



Instead of object name random numbers and alphabets are generated each time after which when the test is played it fails to identify the object. How can i resolve this issue? In mapping editor or any other assistance would really be appreciated.



Darshan Shah
  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3
    Restart TestComplete and see if that resolves the issue.  If not, restart your machine and check again.  I have seen that issue at the end of the day when I've been working in TC all day and I don't know what causes it but restart/reboot seems to take care of it.
  • darshanyshah's avatar
    darshanyshah
    Occasional Contributor
    Marsha



    Thanks for your reply. I did try restarting both my machine and TC but that doesnt help. I think the application in the backend has these random names for objects.



    Is there a way to map to object so that it identifies other values within the object and not just try to search it by name only?



    Darshan
  • darshanyshah's avatar
    darshanyshah
    Occasional Contributor
    To add further- The Object name is changed each time the tested application is launched.
  • Darshan,



    I'm afraid this problem is not limited to name mapping, and I'm beginning to believe it may not be a problem with TC at all.

    I avoid name mapping in my tests, using the FindChild routine extensively instead.



    For about six months I've been seeing problems like you're describing.  I'm talking about a form that is repeatedly opened and closed in my test being named correctly several times and then suddenly it's got a different name and the test fails.



    It's like TestComplete is detecting that a new object has been created, and trying to read the object's name, but something is going wrong and it can't.  Instead it gets one of these odd seemingly random names.



    At the same time i've noticed that my application is pausing for long periods of unresponsiveness whenever the name goes wrong.  I've also noted that these (or similar) pauses are present even if TC is not running.



    Although I have no way to test whether the misnaming problem is present if TC is not running, what I know for sure is that whenever there is a misname event in TC, it always follows one of those long pauses when opening a form.



    Because the unresponsive pauses happen whether TC is running or not, I think this problem is rooted in a Windows update that hit some time in August or September of 14.  That's when I first noticed it.  I think the misnaming is coming from Windows.



    I have very slightly improved things by upping my method invoke timeout to 60 seconds.  I've also wtitten code into my tests that detects when something critical is misnamed, and loops closing and reopening the relevant form until it decides to name the affected object correctly.



    It's a clunky brute force method of dealing with it, and there is a possibility of it looping indefinitely, but at least I am no longer failing every test for a bogus problem.  

    (I say bogus because the Application still works, its just that TC can't address it properly if the name happens to be wrong) 



    If you ever find a way to prevent this, please be sure to post it to the thread.  I am subscribing to every similar thread I find hoping that one of them will eventually give the answer to this.