Forum Discussion

dhy's avatar
dhy
New Contributor
9 years ago

How do I map a child object using one of the parent object propeties

I am running TestComplete on a Silverlight web application and have a question.

 

With the nature of our software, the listing of the Silverlight objects can change based on Runtime generation. There is a property of the Parent objects that never changes(it is related to the field in the Database in which the data resides). I would like my tests to recognize which object on the screen to interact with(I interact with the child objects) based on the property of the Parent.

 

I understand this is worded somewhat poorly. I have a difficult time articulating exactly what I am seeing and what I believe I need. Essentially, I would like Testcomplete to recognized which child object I am interacting with based on a specific, unique, property of the Parent.

3 Replies

  • NisHera's avatar
    NisHera
    Valued Contributor

    If your child object properties defined on run time do not map it.

     

    You will end up with unwanted mappings which can be a headache later. Instead you can map whatever the stable parent (as you mention).  In run time you can call child object using parent. For eg there are two unique parents X and Y but both have a child call z, you can call X.z or Y.z depending on your requirement.

  • Map up to the parent which can be identified uniquely. As far as i understand the number of child will vary at runtime. We can get the number of child at run time using the ParentObject.ChildCount call and use theParentObject.Child(i)(i is the child index) to manipulate the induvidual child. Hope this helps

    • djadhav's avatar
      djadhav
      Regular Contributor

      You can do it this way:

      1) Map the parent that has stable and unchanging identification properties

      2) Use the FindChild method as described here to find the child object.

       

      sQAT