Forum Discussion

MadGrb's avatar
MadGrb
Contributor
5 years ago

Two diffrents objects with same name in Mappingtable

Hi,

I have massive problem with my project.

 

There is two Combobox in my form, but that saved in Mapping as on name. So, when I run my test, TC can recognize just a Objects and Clicked twice on first-object.

 

Please look at Pic.

  • Most likely the problem is that your criteria for mapping the objects is not unique enough.  So, both objects match the mapping criteria you have defined so both objects are shown as mapped to the same item in your Mapped Items tree.  

     

    This happens frequently with allowing TestComplete to automatically map objects without doing any review of said objects.  Two things to keep in mind when mapping objects.

     

    1) Objects are mapped based upon who their "parent" is

    2) Objects are mapped based upon the set of property/value pairs.

     

    So, if your mapping tree has the objects having the same parent and the same property/value pairs.  You'll have this conflct.  

     

    Some tips:

     

    1) Go to Tools -> Options -> Engines -> NameMapping and turn OFF the object to use extended find whenever possible.  Extended find is a good feature but, if over used, you'll end up with a parent hierarchy that is too general and you end up with this problem.

    2) After recording a test, go back and look at what was mapped and make any adjustments on propery/value pairs.  Look for values that change dynamically with each test run and modify those appropriately or even remove them and replace them with other properties.

    3) Use more than one property/value pair to map an object.  The more properties you can include to distinguish one object from another, the better.  For example, in your case, it's possible that it's simply using the "class" property... two objects, same class, same parent... same mapping

  • You're in Aliases.... you can't drag an Alias to a parent that is not a parent in the Mapped Objects.  There is another "tree" above the one you're manipulating that is the Mapped Objects tree.  That's where you do your main NameMapping editing and manipulating.  Aliases are used to take a Mapped Object and give it a structure and Name that is more useful in coding.

    See https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/about.html#aliases-and-mapped-objects

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Most likely the problem is that your criteria for mapping the objects is not unique enough.  So, both objects match the mapping criteria you have defined so both objects are shown as mapped to the same item in your Mapped Items tree.  

     

    This happens frequently with allowing TestComplete to automatically map objects without doing any review of said objects.  Two things to keep in mind when mapping objects.

     

    1) Objects are mapped based upon who their "parent" is

    2) Objects are mapped based upon the set of property/value pairs.

     

    So, if your mapping tree has the objects having the same parent and the same property/value pairs.  You'll have this conflct.  

     

    Some tips:

     

    1) Go to Tools -> Options -> Engines -> NameMapping and turn OFF the object to use extended find whenever possible.  Extended find is a good feature but, if over used, you'll end up with a parent hierarchy that is too general and you end up with this problem.

    2) After recording a test, go back and look at what was mapped and make any adjustments on propery/value pairs.  Look for values that change dynamically with each test run and modify those appropriately or even remove them and replace them with other properties.

    3) Use more than one property/value pair to map an object.  The more properties you can include to distinguish one object from another, the better.  For example, in your case, it's possible that it's simply using the "class" property... two objects, same class, same parent... same mapping

    • MadGrb's avatar
      MadGrb
      Contributor

      Thank you so much that's working