Forum Discussion

dhundley's avatar
dhundley
Regular Contributor
7 months ago
Solved

how to best handle objects that get mapped with names that vary from one run of the AUT to another

This is a case that i just opened with SmartBear support but i'm also pasting in the forum to see if i get a quicker solution

 

The desktop application, for which we are developing automation, can have multiple subtabs for a given window tab

 

each one of the subtabs has its own menu panel on the left side of the screen. this menu panel is divided into sections (Details, Tasks, etc) and there are clickable links under each section. When recording the links being clicked in TestComplete, each new subtab is getting mapped into the NameMapping repository and the index associated with it is used in the name mapping process. In the Object Browser

 

you can see the instances of these subtabs each having a different indexed value (2, 3, 4). the one that is currently visible on the screen is highlighted while the other two are dimmed. The issue is that during the recording a particular subtab with all its child objects are getting mapped using the current index value but later, during playback, it might have a totally different index and the object cannot be found.

 

What is the simplest, easiest and recommended way to deal with this type of situation? Is it possible to use wildcards for the index? Thanks

  • Yes, you can use wildcards for the index but I would try and find another field to use in the mapping that's stable and unique. We avoid using index in the map for this very reason. The time it takes to edit the mapping to use another field is minimal and will be worth it in the long run.

3 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Yes, you can use wildcards for the index but I would try and find another field to use in the mapping that's stable and unique. We avoid using index in the map for this very reason. The time it takes to edit the mapping to use another field is minimal and will be worth it in the long run.

    • dhundley's avatar
      dhundley
      Regular Contributor

      i removed the index property which required an integer and therefore could not be replaced with the wildcard character. i replaced that with the name which had the index value included as a string thus allowing the use of the *. I also added the Visible = True and the VisibleOnScreen = True properties to identify the object and all that appears to be working. I was able to move any child objects from the other objects (which had been created with an integer on the end) into the main object (without an ending integer). As I moved them I simply answered No to deleting the aliases but Yes to correcting in the keyword tests. then i repeated that process down in the aliases section until I was left with just the one main UltraTabPageControl object with everything under it. There were a few places where the old names were in IF statements or the Value column of a keyword test that I had to manually change but so far it looks good. Thanks!

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If your developers can "label" each of the tabs,

    Then it will make it easier for TC, to select a tab based on label name.