Forum Discussion

Novari-QA's avatar
Novari-QA
Frequent Contributor
7 years ago

Name Mapping - How to remove parent objects but persist children

In my example, i have 
- Screen
  - Panel
     - Table
       - Table
         - Cell

What I would like to do, since in no circumstance do i care about the Panel or tables, i just want to go. Screen.Cell.  However if i move the cell to be a child of screen, it screws everything up. 

I want:
- Screen
 - Cell

Thoughts?

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    OK... are you doing this editing in the Mapped Objects panel or the Aliases panel?  It does make a difference.

     

    Also, are you using the "Extended Find" option on any of these objects?

     

    Basically, here's what I would do...

     

    1) At this point in time, if there's no "problems" with mapping and extra panels, I wouldn't change anything in the Mapped Objects panel.  That can be left exactly the way it is.

    2) In the Aliases panel, drag the "Cell" object to be a child of the "Screen" object.  You'll now have something that looks like

     

    - Screen

      - Cell

      - Panel

        - Table

          -Table

     

    3) Right click on "Panel" and select Delete.

    4) There will be a prompt that will say something about "Do you want to delete this alias and it's child aliases?"  Say Yes

    5) There will be ANOTHER prompt that will ask if you want to delete the mapped items as well... say NO.

     

    So... Mapped objects will still have the original hierarchy... but Aliases will now simply have 

     

    - Screen

      - Child

     

    And that's what you'll use in your test cases.

     

    Just to explain... there are two layers to NameMapping...  There's the Mapped Objects which is the actual configuration for finding and identifying objects (see my previous response to you describing how that works).  Then there's Aliases.  Aliases are a way of translating the Mapped Objects into something that is more usable.  As you said, you don't care, really, about all the panels and tables.  They can still be present for identification but you can adjust your Alias to be more meaningful to you.

    • Novari-QA's avatar
      Novari-QA
      Frequent Contributor

      Okay, i see my issue, i was saying yes yes. The other issue is that I want my mapped objects to be as clean as my aliases, but i suppose I can work with that. :) Thank you

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        To make the mapped objects look like your aliases, you'll need to do a bunch of rework of the Aliases...  What I would do is, in the Aliases, delete EVERYTHING from Panel on down, including Cell, and make sure you select "No to all" on the second prompt.  Then, in the Mapped panel, make sure you check the "Extended Find" checkbox beside the Cell item.  Then, drag Cell to be a child of Screen in the Mapped panel.  Then, in Mapped Objects, delete the Panel and all children.  Now, drag the Cell from the Mapped Objects Panel down to the Screen item in the Aliases panel.

         

        But, honestly, that's not necessary.  The Mapped Objects panel can reflect 100% of all your objects in your application but then, as noted, you can use the Aliases panel to make things more meaningful and useful.  Then, if necessary, add the "Extended Find" check mark if the developers change things.

    • Novari-QA's avatar
      Novari-QA
      Frequent Contributor

      Is it possible to link children to a fake alias?

      For example
      we have 2 screens. Login and Login_2

      Id like the aliases to look like this

      - LoginScreen

       - UsernameTB
       - PasswordTB
       - PinTB

      But since we have 2 pages, it comes out like this

      - LoginScreen
       - UsernameTB
       - PasswordTB
      - LoginPinScreen
       - PinTB

       

      Id like the LoginScreen to be a fake alias. and have the children mapp to their correct urls.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Every item in Aliases must have a representation in Mapped Objects.  Remember, mapped objects does the identification.  So, if there's an item in Aliases, TestComplete tries to go to that item and check the Mapped Objects to see if it can identify it, inclduing parent objects.  The Aliases need to represent something of the hierarchy of the Mapped Objects... so, if PinTB is not somewhere in the descendant tree of LoginScreen, you can't make it a child of LoginScreen in the Aliases.  Again, keep in mind, Aliases is a translation of Mapped Objects but it still needs to follow, somewhat, the logic of Mapped Objects with regards to identification.  

         

        The logic would be, to identify PinTB, it would first need to identify the parent.  So.... in what you want, it would first go to LoginScreen and identify it.  Then it would say, "Find the child of LoginScreen that matches the criteria of PinTB".  Because PinTB is not an actual child of LoginScreen, this identification will fail.