Forum Discussion

adoublin's avatar
adoublin
New Contributor
9 years ago

Issues with Aliases when using objects with groupboxes

I am having an issue with using a Mapped Object that has an ever-changing WndCaption. 

 

In my project that happens to be a Groupbox that has a text change based on the amount of rows in the child datagridview (ex: Rows = 12)

 

This results in multiple Mapped Objects and Aliases being created and test failing if a row is added or removed. 

 

Is there a way to either join these together to be referenced through one Alias or any nicer way of handling this without having to have multiple Aliases and Mapped Objects?

 

Thanks in advance.

  • baxatob's avatar
    baxatob
    Community Hero

    Yes, you can use a conditional name mapping or use a variable as the property value of mapped object.

     

    For conditional name mapping you should map all possible values of property: 

     

    WndCaption = "Value1" 
    OR WndCaption = "Value2"
    AND NOT WndCaption = "Value3"
    etc.

    You can also use a wildcards to define your property value (e.g. WndCaption = "Value*")

     

     

    Other way is using a variable:

     

    WndCaption = yourVariable 

    You can assign the variable before or during your test.

  • We sholud use only unique property associated with the control to map the control. In your case the WndCaption property gets changed depending on some other changes. So we shoult not use that property to identify the control. Instead we should identify the properties that are not changed even if we add or delete rows in child datagridview. Hope this helps