Forum Discussion

veronica_glynn's avatar
veronica_glynn
Contributor
11 years ago

Handling Dynamic tree ID's

Hi! I am having a lot of difficulty automating our tree items. My first issue is that we use Component Art and Test Complete does not support that as of right now so I am struggling to figure out a way to automate it. My other issue, is that every time you refresh your user session, the tree ID's change. And it isn't just the object ID, it is also the table and panel ID prior to it. I have seen a lot of posts about using '*' wildcards and what not but I need some guidance on exactly where this needs to occur. My NameMapping directory is getting littered with hundreds of objects because it sees these objects as 'new' even though they aren't. Is there anyway to force Test Complete to recognize Tree Item A no matter what the ID is?



example:

XX - indicates dynamic ID



TreeItemA (Alias.Browser.pagecognero.formForm1.panel.TableIDXX.cellXX)

TreeItemB(child of A) (Alias.Browser.pagecognero.formForm1.panel.TableIDXX.cellXX.panelXX.itemXX)



and so on down the tree. I would like to be able to pass in the object name and call the 'Click' property since they do not support 'Expand'. But since it is a moving target, I haven't been successful.



Thanks for your help and let me know if you need more info!



Veronica



9 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    The key in NameMapping is the smart selection of your criteria.  If your ID is changing from session to session, that is not good criteria for mapping (even though TestComplete may be defaulting to that).



    Consider some other options that, in combination, may actually work better.  Like combining Caption, ObjectType, and even adding in "required children".



    NameMapping does take an art at times to get it right.



    If you need more specifics, it would be helpful to have some screenshots of the Object Properties of the objects you are attempting to map.  Then I can give some better hints.
  • Hmm. I looked in the object configuration for the items you mentioned and the only one available was ObjectType which really isn't going to do much for me. Just so I know exactly what you would like to see, do you need the details of the item I need to map within TC or via my browser? 



    Thank you so much for your help!
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Details within TC's Object Browser would be helpful... 



    Glad to help!
  • Here are 2 of the items. The first one is the parent node in the tree. The second one is a folder that is contained within. Please let me know if you need further details.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Veronica,


     


    You need to start working with this element in the Name Mapping editor:


    Alias.Browser.pagecognero.formForm1.panel.TableIDXX


     


    Look at the name of properties used to map the table and their values. Navigate to this table in TestComplete's Object Browser and check whether there are any other tables on the same level and try to identify the properties whose values may be specific to each table. To see all available properties of a control, switch to the Advanced View mode in the Object Browser and allow showing hidden properties. Refer to the "Basic and Advanced View Modes" article to learn more about these two options.


     


    Once you find the reliable properties, remap the object manually.


     

  • Okay. If I am understanding you right, then I think I need to change the mapping to point to the idStr = QSetTree_item_0_cell because that doesn't change. However, I don't know how to change the mapping of this item. It will not allow me to edit the mapping once it is in place. Do I delete the item out and then 'remap'? If so, how do I tell TC to map on a different field?



    Sorry for all the questions. 
  • I am uploading some new screen shots of what I am trying to do. My Object Browser is lousy with Tables, Cells, and Panels. I see that it has built a hierarchy of the tree. My question I suppose... is whether my mapping is correct? Do I need to do a 'Find' within my Keyword Test for the Table and Cell of the tree item I want to activate? Is there something better to 'key' off of?



    I also attached a screeshot of the tree itself that I am trying to automate.I am clicking on the first tree node then clicking the '+' to expand. Unfortunately, we are using Componet Art for that control so it is only an image. I cannot call 'expand' on it. Only 'Click'. :-( 



    Again, any insight would be so appreciated. Not being able to truly automate these trees is hampering my automation efforts.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    In order to edit the mapping of an object to add properties to the mapping criteria, the object needs to be available to "query" by TestComplete... in other words, get to the point in your application where the object is present and then attempt the mapping.



    Hope this helps.