Forum Discussion

VFixed's avatar
VFixed
Contributor
10 years ago

Question about using alias for date input box

One of the screens I'm creating a script for has a date 'from' field and a date 'to' field. How can I assign alias names to these fields?

 

I went to the tutorials but didn't see a query function for the tutorials.

 

If someone could provide a link to a tutorial or other documentation concerning assigning alias's I'd appreciate it.

 

Thanks.

9 Replies

  • I don't know how close I am to the official line ..... but, for me, you Alias map should be a much condensed and more "readable" version of the full object map.

     

    It should contain only the key elements needed for you to interact with the GUI. Buttons, textboxes, screens, etc. Container panels etc, which are required for the application to work, but of little interest to you when putting a test together, should not be in there. Aliases should also be named in such a way that makes them much simpler to relate to onscreen elements.

     

    So, in your case, Assuming they are on a simple one screen application, it would look something like:

     

    > Screen

    >> Date_From

    >> Date_To

     

    Which would be addressed in a script (VBScript in this example) as:

     

    Aliases.Screen.Date_From

     

    Simple.

     

    All the above, of course, is reliant on mapping objects reliably in the first place.

     

    I think the default mapping setting just dumps the same thing in both object and alias maps. Don't use it like that. Trim and rename the Alias map so it makes sense!

     

    The support article doesn't go into much detail. More explains how you functionally use them.

     

    http://support.smartbear.com/viewarticle/69473/

    • VFixed's avatar
      VFixed
      Contributor

      I'm studying the help/tutorial link you provided. I was trying to rename the object as you suggested but I don't think I'm in the right place. Is this the right place to assign 'Aliases.Screen.Date_From' ? If I modify the object name, TC no longer can find it.

       

      z.jpg

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        No.

         

        If you go into the NameMapping element of your project, you should see three panels.

         

        On the right, is the large main panel showing the details of whatever object you have selected.

        Beside it, to the left, are two smaller panels. One is "Mapped Objects", the other "Aliases. Drag mapped objects here".

         

        The "Mapped Objects" parts is the full object map. It NEEDS to be complete and contain all the elements required to locate objects within your application.

         

        The "Alias" part however, is up to you. By default, I think it mirrors any mapped objects into the Alias map at the same time. You don't need this. You can delete elemets from the Alias map (container panels and so on) and just leave the key components. You can also rename them on the object tree or in the detail panel for them.

         

        Be ceareful if you delete objects from the Alias map as it will ask if you also want to delete them from the object map. Make sure you don't accidentally delete hapf your application and end up re-mapping it all!

         

        It's worth getting your head round and using it well as it makes understanding mapped object references in your code much easier. Ditto maintaining your object map. If the Alias map is clear and simple, and something breaks due to a change, sort the object map and, if you've done it well, the Aliases (and thus all your tests that use them) will sort themselves.