Forum Discussion

jimsmith_1's avatar
jimsmith_1
Contributor
13 years ago

Help with Name Mapping

One of the web applications that I am testing uses frames that are named dynamically.



So that my tests can find objects within these frames, I have inserted the * wildcard in the variable part of the name in the object mapping

ObjectIdentifier value. This works well. My tests run as expected, finding all objects in the frame regardless of the frame name that is generated by the application.



There is one unfortunate side effect to this approach however...



When I record tests which interact with objects in the frame that are not yet mapped, TestComplete ignores my existing frame mapping (with the * in the ObjectIdentifier value) and creates a new frame mapping with the full ObjectIdentifier name value. I then have to insert the * wildcard in the ObjectIdentifier value of this new frame mapping so that the objects will be found when the test is run.



I now have the frame mapped 9 times. This figure is likely to grow. Each of these mappings contains some of the objects with which my tests interact. I suppose that Testcomplete has to search through each of these frame sub-trees when trying to identify an object. In any case, it seems to find the objects OK.



See attached screen shot.



The problem I have is trying to find objects myself, I have to search through each of the 9 sub-trees to find anything.



So, my questions are...



Is what I am doing the best approach?



Is there any way of merging my 9 frame mapping sub-trees together so that I end up with just one sub-tree for the frame?

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    What I usually do is that, instead of letting the record process do my mapping for me, I use the NameMapping tool (see screenshot) to manually map those components that I want to work with.  This allows me to modify and change things to what I want them to be.



    Additionally, after each record, I go back and check my name mapping to make sure that nothing got improperly mapped.  If it did, you can click and drag a mapped item between trees and nodes and then delete those extra areas.



    Basically, it comes down to doing some due diligence to make sure that your mapping isn't running away on you.
  • Sounds like a bit more work up front to save time and trouble later. I will give it a try.



    If I drag and drop name mapping items in the tree, do the references to those objects in my tests get updated accordingly, or do I have to find and update each test reference individually?
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    In my experience, references get adjusted if they are in keyword tests but not if they are in script code so you'll have to do some re-referencing manually once you have your NameMapping adjusted.