Forum Discussion

dpiotrowski's avatar
dpiotrowski
Contributor
13 years ago

Problems with same MappedName for different objects

Hey, I've came across some problem with the name mapping.



I have several property items in the application under test with indexes 1-8. They are recognized by TestComplete in the object browser as:

Sys.Process("AdaptiveVisionStudio").WinFormsObject("MainWindow").WinFormsObject("dockContainer4").WinFormsObject("parametersWindow").WinFormsObject("filterParameters").WinFormsObject("panelMain").WinFormsObject("PropertyItem")



and they differ only with the index value.



The problem is all the these property items (1 to 8) were automatically mapped by TC to the same MappedName, that is:

Aliases.AdaptiveVisionStudio.MainWindow.dockContainer4.parametersWindow.filterParameters.panelMain.PropertyItem2



This name references to the property item with index '0' so now when I click in the recording on any of these property items each time TC recognizes the one with index '0' (instead of these that were actually clicked).



What I'd like to to is change the MappedName for the property items manually (and setting for these new names proper indexes) but TestComplete doesn't let me saying that the property items are already mapped to the name Aliases.AdaptiveVisionStudio.MainWindow.dockContainer4.parametersWindow.filterParameters.panelMain.PropertyItem2 (which is correct from my point of view only for property item with index '0').



Can you help me with this one? I thought I understand how it works but now I'm really confused since different objects are identified with the same name and I don't seem to find a way how to change it.
  • Of course the indexes are 0-8, not 1-8, sorry. But still the problem is the same.
    • kavansays's avatar
      kavansays
      Contributor

      I am also facing the same issue.. can anyone please suggest solution for this or this is the behavior of the testcomplete? 

       

      Is there any way to set index of the object Runtime through script

       

      Eg. Set oTabPane.tradesTable.JavaFXObjectIndex = 1 ..? 

      (Here i am trying to set the index of the tradestable object to 0, while saving the object to namemapping it was 5. )

       

       

  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)

    Daniel,


    You are right that the mapping settings do not include the Index value. You need to change them.

    To do this, the underlying objects must be available in the system, so --

    * Launch your application and activate the form that displays the objects.

    * Now, open the NameMapping editor.

    * Select your PropertyItem object in the tree on the left of the editor and click Edit on the editor's toolbar.

    This will invoke the Edit Name Mapping Item dialog that lists object properties.

    * Move the Index property from the right list in the dialog ("Available") to the left list ("Selected"), specify the index value to be used for object recognition and click OK to save the changes.

    Now, you can map other ProjectItem objects. When mapping, you select the properties to be used for object recognition. Include the Index property into the mapping condition.

  • Hello Alex,



    Thank you for your reply. I've tried this solution before and it usually works
    fine. But the problem is that sometimes different property items in the
    Object Browser get the same MappedName - for example three different
    property items with indexes 0,1 and 2 have the MappedName of  'PropertyItem'. When I change its index in the editor it still applies to all these three property items which is wrong. What I'd like to do is to have the ability to change the MappedName field in the Object Browser so when different objects have the same MappedName I'm able to edit it. Is this possible?
  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)

    Daniel,


    But the problem is that sometimes different property items in the Object Browser get the same MappedName - for example three different property items with indexes 0,1 and 2 have the MappedName of  'PropertyItem'.


    Not sure I understand you, sorry.  As far as I know, TestComplete does not allow creation of the same alias for different objects.

    If the mapping criteria are defined properly, TestComplete should recognize the objects. At the moment, I think that the mapping options are not set properly and cause ambiguity.


    Can you post here images of the NameMapping editor with the mapping settings for your PropertyItem objects? Also, please post an image of the Object Browser window showing the PropertyItem objects (tree + properties), so that we understand the object structure in your app.

  • I am also facing the same issue.. can anyone please suggest solution for this or this is the behavior of the testcomplete? 

     

    Is there any way to set index of the object Runtime through script

     

    Eg. Set oTabPane.tradesTable.JavaFXObjectIndex = 1 ..? 

    (Here i am trying to set the index of the tradestable object to 0, while saving the object to namemapping it was 5. )