Forum Discussion

abrar22's avatar
abrar22
Frequent Contributor
9 years ago

Long Alias Names

HI All,

 

I have assignes the Long Aliases names to to Single Parent for all objects.For Example 

 

Aliases.ABC_Bootstrapper.wndDockingWindow.wndTabWindow.HwndSource_OptionsWindow.OptionsWindow.PART_Content.this.this.TransitionBox.this.TransitionElement.this.WPFObject("ComboBox", "", 1)

 

I am dragging and dropping to Parent so the Aliases shortens to 

 

Aliases.ComboBox.

 

I have changed the all objects to to single line Aliases. 

 

My question is what are the pros and cons for this approach. One pro I can say is elements have very short names. Also can i create an folder in Name Mapping so i can keep certain elements in it?

2 Replies

  • djadhav's avatar
    djadhav
    Regular Contributor

    That's the reason we have aliases. You are doing it right. We use aliases to make it easy to reference namemapping from your scripts. As long as objects are accurately mapped in NameMapping, it doesn't really matter where you put them in the Aliases.

     

    The only thing to keep in mind is that with generic names, there is a tendency for confusion if you have many elements of the same type. for e.g. If I have a textbox for username, I can name it as Aliases.tbx_LoginForm so I do not confuse it with other text box names.

     

    I am not sure I understand your question about creating folders in NameMapping. There is no feature available that I know of which allows you to do that. What are you trying to accomplish by doing that?

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      As djadhav says, you are using it right.

       

      Alias names should be short. Should cut out invisible "filler" panels. Should be easy to read and relate to the objects on the screen. I tend to use label names (as this is what the user sees on screen). So rather than:

       

      Aliases.ComboBox

       

      I would have:

       

      Aliases.<Application Name>.<Screen Name>.<ComboBox Lable/Name>

       

      You can't create folders. You shoud be using the pages/screens/sections (whatever is most appropriate really) as the "containers" for objects at lower levels. As I say, if done right, it should be as close to a textual representation of you application (the visible parts) as possible.

       

      The object map = everything ..... in detail!

      The alias map = only the bits you NEED .... sensibly named.

       

      One thing you can do, which is sort of like folders, is use multiple instances of a fairly generic object to act as separate containers.

       

      I have a web application I test. It has "tabs" embeded in a section of the web page. But they are not true tabs. So, in my Alias map, I have several copies of the top level tab "container". Each copy is named to represent one of the "tabs" it contains. So the visual feel and representation is retained (ie - the Alias map still reads like what you see on screen) and object location works fine. By using 8 or 9 differently named versions of a single top level object.

       

      I've done it this way since my QTPro days ....

       

      (If your Alias map is a straight copy of your object map .... you're using it completely wrong and might as well not bother with it ...)