Ask a Question

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

NT
Contributor

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

23 REPLIES 23
Marsha_R
Community Hero

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


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
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. 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped

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!

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

Montikore
Occasional Contributor

Hi,

 

I totally agree with you Colin_McRae when you say to use finders. In my opinion, mapping object on a web site is very bad as it is not permissive at all. In my case, i made my own finder using the testcomplete finder on a few properties : you can search for an ID, or an index, or a innerText... which can work if you have an object with no properties but text.

 

mgroen2
Super Contributor

I think TestComplete should be improved, by implementing an internal pre-check prior to test running, in which it valides current name mapping and the use of these name mappings (aliases) in testscripts, to changes (especially on deleted objects)

 

See this feature request. (vote for it if you like the idea). Comments are also welcome.

 

 

 

Seems unlikely.

 

In order to pre-check/validate ALL objects required within a test, they would have to be present.

 

Which isn't going to happen ..... without running all the tests. Many object won't appear without pre-work (ie - making a bunch of selections or entering some data or whatever) so I don't know how TC would validate them without actually running test.

 

Having just read the feature request, I see staff have similar concerns as to how you would actually do it.

 

And I REALLY don't like the idea that it deletes things it can't find. I can see that causing more problems than it solves! Maybe flag them for deletion I suppose, but no way I'd want it just trashing stuff by itself.

 

Any time I get an updated version, I generally accept it will need a minimum of two runs. One to catch up with updates, changes and new functionality. And then one to run and store test results. Except that invariably turns into (a minimum of) three runs. Run to find the changes. Run to test the updates. Run to run the tests.

 

I've long since got past the point where I ever expect ANY automated test (well, anything even vaguely complex anyway) to be totally change-proof. It's simply not realistic. If a dev changes a table name in a DB, and you run queries/tests against that table, your test will HAVE to be updated somewhere. It's unavoidable.

 

For me, it's more about keeping updates as simple and easy manage as possible. Not trying to avoid them completely as you never will.

@Colin_McCrae It doesn't have to be ALL objects, it could be screenbased. Or on a start/stop base. (Tester presses starts to start the examination, and stops it, and after that TC does the compare.

 

See the comments on the mentioned feature request.

 

TC could make a match (screenbased) on the previously mapped objects/testscripts, and the current screen. This is very useful in Agile environments, in which the application changes every day, and the tester doesn't know where/what has changed.

 

Of course it's not up to me HOW to do it. (I'm not a programmer), it's just that with this feature request TC could increase market value for Agile / Devops environments significantly). In such environments there is no time for scripting/testscript mainentance: the intelligence should be built in the tool (TestComplete in this case) itself. It could be done because similar logic is already built into TC already, however it should be extended to the testrun phase. It's important for a testtool to have good bindings to the AUT. Like said in Agile the AUT changes frequently and TC should be changed to make it easier to work with UI changes in the AUT.

 

For me deletion is preffered: I like to have as much clean namemapping model as possible. Things which are not used please delete them. Could be different in different environments therefore this behaviour should be configurable (deletion/marked for deletion/disabled, whatever) in main configuration.

 

Changes are not all alike. UI changes can more easily be tackled by the tool (see feature request) then validation on DB values in the testscriptlogic itself. Thats where the scripter of the future will become more focused on. Detection of UI-Changes and handling them, need to be done by the intelligence of the tool.

 

 

If TC were to automatically remove mapped items and ignore them, wouldn't this invalidate your tests? What if a button is missing but should be there and test complete didn't report this? 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
cancel
Showing results for 
Search instead for 
Did you mean: