Forum Discussion

TJ33's avatar
TJ33
Occasional Contributor
5 years ago
Solved

Searching for the mapped object took to much time...already

Situation:  I'm only 2+ months into the automation effort here and I'm already receiving the message above.  The company hired a consultant to start the project.  As far as I can tell after 2 days of reading on name mapping, the name mapping is in bad shape.  It would appear that they have mapped virtually everything under one node.  I created a branch yesterday and followed some of the documentation to mitigate this but then a lot of tests started failing.

My questions:

1. How do I go about straightening this out?

2. I have found mappings that are 14 panels deep.  Is this normal?

2b. When I'm in the name mapping file and have TC 'Highlight' the object.  At least 3 or 4 of these panels point to the same panel.  Is this normal?

3. When is it appropriate to use 'Extended Find'?  I read a lot about what is does but not so much on when to use it?  I ask b/c almost all objects in my name mapping have this enabled.

4. Is this going to be as difficult as I think it is to straighten out?

Totally bummed...I would not have expected to deal with this for a very long time, if ever.

  • The answer to #1 is probably going to answer a few of your other questions but, basically, you're going to need to do some reworking of your mapping and a LOT of it.  It sounds like the consultant did a lot of record/playback development and let TestComplete do the mapping work automatically.  This is not necessarily BAD, but as you've found out, it can create a rather odd NameMapping structure and even map things inaccurately.

     

    Be sure, though, that you have in your mind the difference between "mapped objects" and "aliases".  Aliases point back to Mapped Objects and Aliases can have different naming and truncated hierarchies while the Mapped Objects may be more expansive.

     

    So, to answer #2, yes, in Mapped Objects, especially in Web applications, this is not unusual.  Every Div and Panel and Table and Cell can potentially be mapped until you get to the actual component you are operating against.  This is why Aliases can be shorter.  You can have NameMapping.Sys.Browser.Page.Panel.Panel.Panel.Panel.textbox in your Mapped objects and that can be referenced by Aliases.Page.textBox in your Aliases.  So, sure, 14 panels of Mapped Objects isn't unusual.

     

    For 2b... if they are doing automatic mapping and they have some dynamic factors in their objects, this is possible, too.  Best practice when letting TestComplete auto-map is to go back and review the mappings and make adjustments.  Sounds like your consultant didn't do that.

     

    As for Extended Find... again, this is a SURE sign that they are doing automapping and didn't really do much with tweaking TestComplete.  By default, I turn the option to "Use extended find when possible" OFF.  That way the automapping doesn't automatically use it.

     

    However, there are judicial uses of it.  Let's say you're working with a Web application where, because it's still underdevelopment, the hierarchy of some objects keeps shifting.  One day a table is 3 DIVs deep.. the next it's 2... and the next it's 5.  So, you map the table and check the flag and now, no matter how many DIVs, the table is always found.  There's a caveat in that the more extended find that is on, the more objects "skipped", the longer object identification can take... hence the error message you have as the title of your OP.  There was a long search to find the object so TestComplete timed out.  Extended find is good... but it should not be used to that extreme as it has performance issues.  Additionally, if you use it TOO much, you may also get the problem in 2b where one time the object is mapped you get one hierarchy, the next time it's used another hierarchy is created and so on.

     

    As for #4... it's going to be painful.  but here's the thing... The code is written based upon Aliases.  So, you can, potentially, leave the Aliases as is and not have to worry about changing any actual automation code.  If you work solely in the Mapped Objects part of NameMapping and preserve those Aliases, you can do this and have a better mapping structure in place.  If you DO need to change an Alias, at least with regards to Keyword tests, changing an Alias will automatically update any keyword tests referencing that Alias.

     

    This is going to be painful for you, but there's hope.  Because once it's done, you can maintain better.

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The answer to #1 is probably going to answer a few of your other questions but, basically, you're going to need to do some reworking of your mapping and a LOT of it.  It sounds like the consultant did a lot of record/playback development and let TestComplete do the mapping work automatically.  This is not necessarily BAD, but as you've found out, it can create a rather odd NameMapping structure and even map things inaccurately.

     

    Be sure, though, that you have in your mind the difference between "mapped objects" and "aliases".  Aliases point back to Mapped Objects and Aliases can have different naming and truncated hierarchies while the Mapped Objects may be more expansive.

     

    So, to answer #2, yes, in Mapped Objects, especially in Web applications, this is not unusual.  Every Div and Panel and Table and Cell can potentially be mapped until you get to the actual component you are operating against.  This is why Aliases can be shorter.  You can have NameMapping.Sys.Browser.Page.Panel.Panel.Panel.Panel.textbox in your Mapped objects and that can be referenced by Aliases.Page.textBox in your Aliases.  So, sure, 14 panels of Mapped Objects isn't unusual.

     

    For 2b... if they are doing automatic mapping and they have some dynamic factors in their objects, this is possible, too.  Best practice when letting TestComplete auto-map is to go back and review the mappings and make adjustments.  Sounds like your consultant didn't do that.

     

    As for Extended Find... again, this is a SURE sign that they are doing automapping and didn't really do much with tweaking TestComplete.  By default, I turn the option to "Use extended find when possible" OFF.  That way the automapping doesn't automatically use it.

     

    However, there are judicial uses of it.  Let's say you're working with a Web application where, because it's still underdevelopment, the hierarchy of some objects keeps shifting.  One day a table is 3 DIVs deep.. the next it's 2... and the next it's 5.  So, you map the table and check the flag and now, no matter how many DIVs, the table is always found.  There's a caveat in that the more extended find that is on, the more objects "skipped", the longer object identification can take... hence the error message you have as the title of your OP.  There was a long search to find the object so TestComplete timed out.  Extended find is good... but it should not be used to that extreme as it has performance issues.  Additionally, if you use it TOO much, you may also get the problem in 2b where one time the object is mapped you get one hierarchy, the next time it's used another hierarchy is created and so on.

     

    As for #4... it's going to be painful.  but here's the thing... The code is written based upon Aliases.  So, you can, potentially, leave the Aliases as is and not have to worry about changing any actual automation code.  If you work solely in the Mapped Objects part of NameMapping and preserve those Aliases, you can do this and have a better mapping structure in place.  If you DO need to change an Alias, at least with regards to Keyword tests, changing an Alias will automatically update any keyword tests referencing that Alias.

     

    This is going to be painful for you, but there's hope.  Because once it's done, you can maintain better.

    • TJ33's avatar
      TJ33
      Occasional Contributor

      As always, I very much appreciate the response Tristan.
      Great info and looks like I need to get to work!

      Thank you!!