Forum Discussion

herbie68nl's avatar
herbie68nl
Occasional Contributor
9 years ago

Objects in an Alias keep changing every TestRun, how can I point directly to an object?

I have a problem when replaying recorded scripts.

 

If I rerun the script on the same application (version) Objects change, which results in the script giving an error because the object cannot be found.

 

Example:

Call Aliases.Applic3.FO_CRMMain. StdForm.UO_RelLst.splitContainerControl3.SplitGroupPanel2.tabEigenschappen.tabBereikbaarheid. labelControl7. textBoxUsrNm.SetText(usrCredentials)

 

- Applic3
- splitContainerControl3
- SplitGroupPanel2
- labelControl7

 

Can differ every run, for example Applic3 becomes Applic and labelControl7 becomes labelControl4

Every time the script executions stops and asks if I want to update the object another time if want to retry.

Is there a way I can handle those changes?

 

For me this is an impediment on reusing created scripts, this problem occurs if I rerun in the same application version and even more if I update the application to another version.

 

I see other issues of this kind where the user is advised to Map to the desired object, but my I think My problem will remain, because if I Map the previous Alias to a new mapping, the underlying alias stays valid.

 

My bottom question is, is there a way to point to objects in a way they always will be found from my VB test scripts?

 

Herbert

3 Replies

  • You need to find some properties with which you can reliably identify the objects in your application.

     

    You can also modify the properties used with wildcards (eg - Applic3 / Applic7 / Applic999 .... would all be covered by Applic*). However, be careful with this. If you had Applic3 and Applic7 on screen at the same time, using a wildcard would cause it to no longer be unique.

     

    Recorded scripts/objects are a good starting point. But you can't rely on the automatic capture to give you robust, unique identification properties. If you want to use mapped objects, you pretty much always have to accept some manual intervention in mapping them if you want them to be robust long term.

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      Also - I don't think you're making best use of the Alias map.

       

      Your look just like the full object map versions.

       

      The point of the Alias map is to condense (get rid of container panels you don't really care about but that need to be there) and rename to make it more readable.

       

      The full object map needs to be what it is. The Alias map should look more like representation of the parts of the screen the user (and you, as the automated test writer) actually care about.

       

      eg:

       

      Object: Browser.Page.Tab.Frame.Frame.Container.Panel.Panel.Button

       

      I would Alias as:

       

      Browser.Page.Tab.Button

       

      (Assuming all the frames, containers and panels were just ways of splitting the screen up, but not things the user actually interacts with)

       

      My Alias maps are MUCH smaller (and more legible) than my full object maps ...

    • herbie68nl's avatar
      herbie68nl
      Occasional Contributor

      Tank you,

       

      using wildcards will be helpfull in many cases for me, The parts that may lead to other screens, or objects I wil leave the given numer, but there are parts where I am sure I will get the correct object if I use a wildcard.