Locked Automation ID: Is not available for 4.0 Winform Applications

  • Thursday, April 12, 2012 10:22 AM
     
     

    Hello,

    Our application was built in .Net 2.0 and we transformed to 4.0 recently. We have both WPF and Winform controls inside our application at different views.

    I am able to see Automation ID property for WPF controls and not for Winform. I know, winform technology is MSAA and WPF has UIA.

    Is there any work around to have something similar to Automation ID? Using Control name for searching element is a bad practice and has more maintenance cost.

    Thanks,

    Ganesh Kiran

All Replies

  • Friday, April 13, 2012 10:30 AM
    Moderator
     
     

    Hi Ganesh,

    I would like to know if this winform control is user control or the standard control? If it is a usercontrol then you could add a custom property as AutomationId in it and exposed this property, so that Coded UI could recognize this AutomationId. If it is a standard control, I guess it’s a huge project to add this property and exposed it.

    Hope this could help you.


    Tony Xiao [MSFT]
    MSDN Community Support | Feedback to us

  • Sunday, April 15, 2012 10:45 AM
     
     

    Hi Tony,

    Thanks for your reply.

    Can you please answer below questions:

    1.We have some User control inside our view and some standard control.Can you please explain me in detail with 2 examples.

    For custom user control and  standard user control.

    2.Also, I want to make these changes in my test code and not in the developer code. It will be huge and night mare to have.

    What will happen, if I add some controls to the UIMapDesigner.CS from the UITest builder. The Automation ID added to the controls are lost?

    Am not even sure on if we add AutomationID property in the XAML file. 

    Your answer in this is really appreciated.

    Thanks,

    Ganesh Kiran

  • Wednesday, April 18, 2012 10:07 AM
    Moderator
     
     Answered

    Hi Ganesh,

    1. If you are building a User Control then you could add any other private fields or public properties in its class, and these properties would be exposed, so the Coded UI Test could identify them then you could use these properties in search properties group for your control.
    2. The automation id would not lost if you add this control through test builder. WPF control could add AutomationId as its exposed property in xaml, and the Coded UI record engine would get them from captured wpf control then use it in search condition group, in case of you don’t find this id in control’s search property group then you could add it by hand.

    Hope this could help you.


    Tony Xiao [MSFT]
    MSDN Community Support | Feedback to us