Forum Discussion

NT's avatar
NT
Contributor
9 years ago

How TestComplete map objects in memory and on what logical basis the objects are mapped

I work as a software tester for almost six months, and I use TestComplete test tool.  In the first month I had completed basic training and I was able to practice in the following months on projects that allowed me to master different features of the tool and performe complete series of tests.

Despite the succes of project’s test, I have still difficulties in name mapping and "I want to understand it deeply to  master more and more the tool. My questions are:

  1.  How TestComplete map objects in memory and on what logical basis the objects are mapped.

For instance i have a button named «Sauvegarder » that is  mapped  as following :

 

Full name(Object Browser) :

Sys.Browser("iexplore").Page("http://c2atom-acc/C2Atom/home#/ticket-form/3710").Section("content").Panel(2).Panel("MainTabs").Panel(0).Panel(0).Form(0).Panel(0).Panel(0).Panel(1).Panel(0).Panel(2).Panel(1).Button(0)

Mapped Object

NameMapping.Sys.browser.pageC2atomApplication.sectionContent.formNgDirtyNgValidNgValidRequire.panelTicketfullLoading.panel.buttonSauvegarder

Aliases :

Aliases.browser.pageC2atomApplication.sectionContent.formNgDirtyNgValidNgValidRequire.panelTicketfullLoading.panel.buttonSauvegarder

 

For instance, I know that :

Page("http://c2atom-acc/C2Atom/home#/ticket-form/3710") matches pageC2atomAplication  in  either  Mapped Object or Aliases

And

Section("content") matches sectionContent in either  Mapped Object or Aliases

And so one…..

But sometime i noticed that despite correct mapping my tests fails, when i return to the original error,  I’m not able to  identify the mapped object  in object browser,  by highliting it,  and vice versa. I remap a second time with automatic or manuel mapping using some features of name mapping like «Conditionnel mapping, Extended Find, wild card, required children, changing properties……. » and others one,  but  there are no result.

Every day I consult online documentation  in smart bear support, forum community, also  documentation on  testcomplete help and  videos training  of  lino Tadros, Nick olivo and cregg Hansson, but i still not finding solution to my problem

2 - Please i ask you a reference like Book of name mapping, it’s extremely important for me because I don’t want to let tests works randomly.

     How can I get complete documentation and  what do I do.

 

 

Thank you for response

  • cunderw's avatar
    cunderw
    Community Hero

    Especially for web testing I have found that I have had much better luck with a very minimal name map, and instead, use the FindChild method on objects, using criteria that are unlikely to change. 

     

    This has provided a much more stable test. You might want to read into this functionality and give it a try. 

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      Also, you should make better use of the Alias map.

       

      The name map contains the full reference to the object. Including all invisible panels required to build the page/object. But many of these intermediate layers (Panel 1/Panel 2/Panel 3/Panel 4 etc etc) you don't care about as you don't interact with them.

       

      This is what the Alias map is used for. It should be a more concise and readable reference to a control. And give them sensible names.

       

      EG.

       

      Mapped name: Browser.Page.Frame.Panel.Panel.Panel.ButtonContainer.Panel.SaveButton

       

      would probably have an Alias along the lines of:

       

      Alias name: Browser.Page.ButtonContainer.SaveButton

       

      (With names like that. If the save button mapped as "afxWNDsvBTNx53a", then change it's name to "SaveButton" as it's much easier to read!)

       

      As other have said, your identification properties for object HAVE to be bulletproof and reliable. If they are not, you WILL have long term problems.

       

      And again, as others have said, you can also use "helper" or "finder" functions instead of/as well as name maps.

       

      Which is fine. But don't make them too broad. If you have a very busy website, with a lot of objects in the DOM, finding every single object needed during a run using "Browser.Page.<FIND OBJECT ROUTINE>" can come with a big performance hit. And if you run a test on a slower machine (say, using TestExecute on a lower power VM) the slower performance can cause problems with a test which works fine on a more powerful machine.

       

      I use a mixture of maps and helper functions. Map the high level static stuff, dynamically find the low level, more changeable stuff. I also use generic control handlers to avoid writing application specific routines as much as possible. A control handling function is portable. An application handling function generally isn't.

       

      Think of the information captured when you map objects as a baseline. You then need to make it reliable and readable!

      • NT's avatar
        NT
        Contributor

        thank you for your reply,  I understand all your recommendations for the proper use of the test tool. As you mentioned, identification of the properties have to be bulletproof to avoid any mapping difficulties, I agree with you, but when I have object mapped that don’t carry no more properties to be defined as a single identification of the object or has no signification or also disabled, which solution will be possible on the choice of objects properties?

        NB: according to lino tadro “ID” is not recommended for unique identifier of the Object to map, but Index it is.

         

        Thank you for response

  • It's very easy to end up with duplicates or conflicts in a Name Mapping file that will end up causing it to behave badly.  

     

    The first thing I would look for is to make sure that there aren't any duplicate branches for the area that is causing the issue.  It also helps if the branches have some unique identifier as close to the top as possible.

     

    If you are still stuck, I suggest contacting support.  They can take a better look at your name mapping than we can from here.

     

    https://support.smartbear.com/message/?prod=TestComplete