Forum Discussion

parthkar27's avatar
parthkar27
Occasional Contributor
6 years ago

Difference between Aliases and Name Mapping and thier significances

Hi ,

 

While working on test complete, I came across a two workbenches under Name mapping section "Aliases" and "Mapped Objects". I found that the parent node of Mapped Object was "Sys" and for "Aliases" it was a process e.g. "CNEXT." I would like to know what is the difference between these two work benches and why was "Aliases" intorduced if "Mapped Object" workbench could provide information about the Object?

Below are the images for Mapped objects and Aliases

 

 

 

 

Regards,

Parth

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Mapped Objects are the direct engine identification for the objects that are mapped for use in tests.  Aliases are a way of referencing the Mapped Objects in a more user meaningful fashion.  Additionally, where as, for example, you could have a Mapped Object that has something like

     

    NameMapping.Sys.MyApp.MyForm.MySubPanel.AnotherSubPanel.EditBox

     

    The Alias can be collapsed manually to simply be

     

    Aliases.MyApp.MyForm.EditBox

     

    Reference https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/overview.html#about-the-mapped-objects-and-aliases-trees

     

     

    • parthkar27's avatar
      parthkar27
      Occasional Contributor

      Hello Robert,

       

      Thanks for the explanation.

       

      But as we can see in the example, the classification path or the address of the object between  Mapped Names and Aliases are different

       

      NameMapping.Sys.MyApp.MyForm.MySubPanel.AnotherSubPanel.EditBox  -  name mapping

      Aliases.MyApp.MyForm.EditBox - Aliases

       

      These two cases , if compared we can find that "My Subpanel" and "Another Subpanel" is missing then how does the tool land up to that particular object.

       Why does it not show any errors?

       

      Thanks in advance.

       

      Regards,
      Parth.

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Did you read the article?  It explains the whole thing.

         

        Aliases point to Mapped Objects.  So, Aliases.MyApp.MyForm.EditBox points to the mapped object... and the mapped object is used then for finding and identifying the object.  Aliases are, exactly as the name implies, an "alias" for the mapped object.

        The idea is that MySubPanel and AnotherSubPanel are mapped to be able to provide identification... however, because they are not strictly needed to be referenced for the test itself, the Alias edit window allows you to "collapse" the tree to be able to make referencing objects more user-friendly.

         

        This is more easily seen in Web applications where a single text edit box may have a full path of something like

         

        NameMapping.Sys.Browser.MyPage.Form1.Panel1.Table0.Cell13.Panel2.Table1.Cell23.TextBox

         

        All that stuff in between is simply DIV tags and tables and cells used in the HTML to format the rendering of the web page.  It's really rather cumbersome to enter that whole thing every time you want to reference that TextBox and, for that matter, it's not readable.  If I'm scanning a test to find stuff, that's a VERY long string.  

         

        When you first record the test, you MAY get an Alias that then reads almost exactly like that.

        Aliases.Browser.MyPage.Form1.Panel1.Table0.Cell13.Panel2.Table1.Cell23.TextBox

         

        So, the totally COOL feature of Aliases is that, because the Aliase REFERENCE the Mapped object, in Aliases, I can drag TextBox to be a direct child of MyPage and then delete the Aliases for everything else, PRESERVING the Mapped Object.  So, the Mapped Object remains as is... and now the Alias reads as

         

        Aliases.Browser.MyPage.TextBox

         

        The object hasn't changed... the Mapped Object hasn't changed.  Only the organization of the Alias has changed for the purpose of readability and convenience.  

        This works for Desktop, Web, and Mobile applications in TestComplete.  Again, the article explains it all.  The logic is like so:

         

        1) The test makes a reference Aliases.Browser.MyPage.TextBox

        2) The NameMapping Engine of TestComplete looks at the Alias and finds that it references NameMapping.Sys.Browser.MyPage.Form1.Panel1.Table0.Cell13.Panel2.Table1.Cell23.TextBox

        3) The NameMapping Engine then uses the NameMapping Mapped Object to perform its task of finding and identifying the object

        4) The object handle is passed back to the test, via the Alias, so the test can interact with it.