Forum Discussion

abinash11's avatar
abinash11
Occasional Contributor
8 years ago

Why no Object repository in TestComplete

I'm a new user to TestComplete. Biggest surprise to me coming from using other test automation tools is the complete lack of the separate Object repository concept in Test complete. Separation of the GUI details from the test scripts is one of the basic functions of a test automation tool and why does not Test complete provide that ?

 

I know there is this Name map thing but it is not the same. You can't add the objects in a screen automatically to the name map by the click of a button like in other tools. Writing code to even find an object is just insane. We have 2000 + objects in the application and are we supposed to wirte code to find each one of them by describing the object properties explicitly ? What happens when the GUI keeps changing ?

 

Also, one can't drag and drop the object form the Name map to the code editor. 

 

I'm totally surprised that an automation tool lacks these basic features that on expect. It literally doubles or even takes more time to do these things which can be done so easily in other tools. Is everyone using this tool this way ? Are there any workarounds to make these tasks simpler ?

7 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Actually, yes you can add items to NameMapping by a click of a button... there is an item in the tool bar that allows you to select an object on screen and add it to your NameMapping. From the object browser, you can also right click on any object and add to NameMapping. When recording, Test Complete can automatically add items.

    With NameMapping, if the GUI changes, you adjust your mapping without having to change your code. For that matter, there is the Aliases layer which separates the mapping from what you actually use in your code so, if your hierarchy of components, properties, etc changes, you can adjust how an object is mapped while keeping the same alias structure.

    While you may not be able to drag and drop into your code (a cool idea, btw, worth suggesting in the feature requests part of this community) both in keyword tests and script code, TestComplete has what amount to an intellisense to the Aliases that makes writing the code easy.

    While NameMapping is not the same as UFT's object repository, it has a lot of power. And I can attest in my current project that, when used well, it can actually speed up test development. We recently upgraded the code for one project to another and all i had to do for the GUI changes was adjust a couple of mapped properties and all my tests ran with no code changes at all.

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      Given your calling it an "Object Repository", I assume you're coming from a QTPro/UFT background?

       

      I was the same.

       

      The Name Mapping in TestComplete is a little different to the Object Repo in QTPro/UFT, but is used in much the same way. What I will say, as you are new to it and this will save you headaches further down the line, is make sure you understand the difference between the full Name Map and the Alias Map.

       

      If your Alias Map is a straight copy of your Name Map, you're doing it wrong. The Alias Map should be a subset of the Name Map. And it should cut out the parts of the application you aren't really interested in (usually series of container panels and frames used to build the page structure). Aliases should also be renamed to be as humanly readable as possible.

       

      So your full Name Map will be a large, technical looking, map of the ENTIRE application. It will have LOTS of layers, be tricky to read unless you do a LOT of renaming, and will be big - as it will contain EVERYTHING. (It has to)

       

      But your Alias Map should be much more readable, smaller, and more like a representation of the application as the user sees it, without all the irrelevant container object they don't care about.

       

      Once you get this worked out and set up properly, it makes using Aliases in you code much more pleasant. It also makes changes to application structure much more manageable. If a few containers change, but the buttons at the end of it do, simply correct the name map and the Alias will continue to work just as it always did. If you find yourself having to update both as a result of container change, in my opinion, your setup is wrong.

       

      You can also use multiple copies of a single Name Map item in the Alias Map, renamed so they "look" different. I commonly do this with container frames which, as far as the user is concerned, are distinct and different panels, but in the background, they actually aren't. But it makes more sense in the Alias Map if they look that way.

       

      And to add to what tristaanogre has already said, yes you can map items using a tool in TC. But, as with QTPro/UFT, expect to have to pay a bit a bit of attention to the properties used and make manual modifications where required if you want things to be reliable long term. It's seldom 100% reliable to use automatic identification properties all the time.

      • abinash11's avatar
        abinash11
        Occasional Contributor

        Thanks a lot. That is a sensible way to manage the objects. Is this described in the documentation in some way ? From the Inital look, it doesn't seem to be obvious.

         

        I will get back after checking the option to add objects automatically, but what can really improve things is a tool which can capture all the objects of the application with its own default properties (which we can define) for each class by the click of a button. Once it captures, we can rename them and edit the properties and so on.

         

        And BTW, is there a way to share the Name map like saving it as a separate file and include in multiple projects etc. ?