Forum Discussion

Vaccanoll's avatar
Vaccanoll
New Contributor
7 years ago
Solved

Make Named Mapping not care about the "Path"

My application has unique names for every single UI element.  But the UI does change on occasion as development is on going.   When I try to setup my application in Name Mapping, I set the ObjectTy...
  • tristaanogre's avatar
    7 years ago

    It has to do with hierarchy... NameMapping identifies an object using two sets of criteria

     

    1. What object are they a child of
    2. What properties they have

     

    Basically, NameMapping will look at Sys and see "Do I have a child that matches the properties of 'browser'"? If so, it returns the browser... then it says, "Does browser have a child that matches the properties of 'myPage'?" If so, it returns myPage... and so on.  NameMapping doesn't scan the whole page to find the component, it only searches based upon the hierarchy tree.

     

    So, when the developers added their DIV, they changed that hierarchy.... so, yes, initially it "breaks".  However, TestComplete has a feature that "fixes" this called "Extended Find".  There are two ways of doing this. First, you can have TestComplete automatically apply "Extended Find" everytime you map something.  This is done under Tools -> Options -> Engines -> NameMapping.  There's an option there that says, "Use extended find when possible".  If you check that item and you map a component, instead of 

     

    NameMapping.Sys.browser.myPage.panel.panel.panelColMd9.panelFormGroup.fieldset.MyMappedName

     

    you might see something more like

     

    NameMapping.Sys.browser.myPage.panelFormGroup.fieldset.MyMappedName

     

    as the extended find will "collapse" the extra panels.  This shows up as a checkbox in your namemapping tree on "panelFormgroup" that is checked.  Basically, this tells NameMapping to search all children of MyPage and their children and their children and so on until you find, in the hierarchy starting with MyPage and object that matches the properties.  This way, if the developers add a DIV or remove a DIV between myPage and panelFormGroup, TestComplete will still find the component.

     

    Even if you don't want Testcomplete to do this automatically, that "Extended Find" checkbox is always available.  So, you can go to your namemapping, check that box beside "panelFormGroup" and then drag that component to be a child of myPage and then delete the intervening panels.  That way, no matter how many DIVS the developers add or remove between myPage and panelFormGroup, it will always find the component.

     

    Several resource for you for this. Go to https://support.smartbear.com/testcomplete/videos/?utm_source=TestComplete&utm_medium=StarterPage and there's a video there on "How To Use Extended Find" which is VERY helpful.

     

    The help topic that goes along with this is https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/managing/modifying/extended-search-criteria.html

     

    Just as a side note: I rarely keep the "automatic" mappings that TestComplete makes for me.  I would say about 95% of the time, after TestComplete maps something for me, I go back and make adjustments and edits to the mapping to account for just this kind of deal.