Forum Discussion

kevinkleint's avatar
kevinkleint
Contributor
15 years ago

My NameMapping changes with each run

OK, I'm using the KeyWordTests function of TestComplete. When I initially mapped to an item, the path was:



Aliases.ceraexe0471.wndAfx.MDIClient.wndAfxFrameOrView8016.AfxWnd80.AfxWnd80



but when I tried to re-map the object, the path was:



Aliases.ceraexe0471.wndAfx.MDIClient.wndAfxFrameOrView8018.AfxWnd80.AfxWnd80



It appears that the wndAfxFrameOrView.... adds a random number starting with 80. Is there a way to bypass that particular node of the control?



Thanks,



Kevin

23 Replies

  • Hi Nikhil,



    I guess you have two different objects which match the same recognition criteria, because the recognition criteria are not unique. That is why when you run the checkpoint for the first time, it matches the first object (the first matching object found by TestComplete), but when you run the checkpoint for the second time, it matches the same object again (although you expect it to match the second object). To help us investigate the problem, please follow the steps below:



    1. Insert the following routine call before retrieving the problematic object in your test (change the process name):




    LogAppStructure(Sys.Process("MyProcessName")) // or  LogAppStructure(Aliases.MyProcess))









    Here is the LogAppStructure routine code:



    Sub LogAppStructure(obj)


      Err.Clear


      On Error Resume Next



      Dim count, i, Str


      


      ReDim params(7) 


      params(0) = "WndClass"


      params(1) = "WndCaption"


      params(2) = "Index"


      params(3) = "Visible"


      params(4) = "Exists"


      params(5) = "ClrFullClassName"


      params(6) = "ProductName"


      params(7) = "ProductVersion"  


      


      Str = ""


      For i = 0 To UBound(params)


        If IsSupported(obj, params(i)) Then


          Str = Str & params(i) & " = " & VarToStr(Eval("obj." & params(i))) & VbCrLf


        End If


      Next


      


      Call Log.AppendFolder(obj.Name, Str)


      For i = 0 To obj.ChildCount - 1


        Call LogAppStructure(obj.Child(i))


      Next


      Log.PopLogFolder






      On Error GoTo 0


    End Sub










     

    // JScript, C#Script



    function LogAppStructure(obj)


    {


      var count, i, Str;


      


      var params = new Array();


      params.push("WndClass");


      params.push("WndCaption");


      params.push("Index");


      params.push("VisibleOnScreen");


      params.push("Exists");


      params.push("Visible");


      params.push("FullName");


      params.push("ClrFullClassName");


      


      Str = "";


      for (var i = 0; i < params.length; i++) {


        if (IsSupported(obj, params))


          Str += params + " = " + VarToStr(eval("obj." + params)) + "\r\n";


      }


      


      Log.AppendFolder(obj.Name, Str);


      for (var i = 0; i < obj.ChildCount; i++) {


        LogAppStructure(obj.Child(i));


      }


      Log.PopLogFolder();


    }






    2. Execute your test and reproduce the problem. The LogAppStructure function will post the entire structure of the tested application to the test log and you will be able to see how objects are recognized right before the problem occurs.


    3. Zip your entire TestComplete project suite folder along with the log of the test execution and send me the archive via our Contact Support form. Make sure that messages in your log correspond to correct actions in the latest version of your test.
     
  • nikhilmv99's avatar
    nikhilmv99
    Occasional Contributor
    HI Allen,



    I have created the log and uploaded to the given link. I received the mail with following subject.

    (Your AQA Support Request: [Issue# M0090567] Not able to validate multiple images since same alias getting used)

    Let me know if you need more information. 



    Thanks,

    Nikhil M V

  • Hi Nikhil,





    We've received your project suite, thanks. Let's continue working on this via e-mail.