This project is read-only.

Best way to automate an in-house custom control

Nov 16, 2008 at 6:39 PM

We're planning to move all our current GUI testing to White. We were able to automate our basic custom controls, but now we're facing some questions: we've a couple of custom in-house .NET winforms controls we'd like to automate. Both directly inherit from Control but one of them is some sort of TabStrip and the other one is similar to a TreeListView.

What would be the best way to access their properties from the tester app? Should we write a Automation Provider or there's a way to get around it from White?


Nov 17, 2008 at 1:28 PM
Have you seen this:

Let me know if you have further questions.
Nov 17, 2008 at 1:36 PM
Sure, I did and I played around a little bit with it. The problem is our control is not just a container, but inherits from Control (it's a WinForms control) and implements everthing on its own, so we don't know yet how to access its internal properties.
Nov 19, 2008 at 6:14 PM
Can you do LogStructure to see the AutomationElements inside your custom controls?
Nov 20, 2008 at 3:13 PM

The control doesn't have automation elements inside. It's a .NET Control which implements a TreeListView but it just inherits from Control. It's the control we use for Plastic SCM workspace navigation, you can see it in action here and here in the form of a tree

I've started implementing IRawElementProviderSimple, ITableProvider interfaces for my control.

But White's ListView still fails with it. I think I need to implement the IAccesible interface too.
Nov 20, 2008 at 7:45 PM
Hi again,

I'm having some weird problems, most likely due to my lack of field experience with UI Automation.

I've made my component (actually a friend class I've made to implement all the Automation stuff) inherit from ControlAccessibleObject and now I'm able to see the rows (making each row inherit from AccessibleObject ) in UISpy.

Problem is the following: if I "enable" the "accesible objects" overriding CreateAccessibilityInstance in my component, then I can't see the patterns implemented anymore in UISpy. On the other hand, if I get rid of CreateAccessibilityInstance and process the WM_GETOBJECT message, I get patterns. But I'm not able to have both at the same time. If I enable both, the accessible objects are gone! :-(

I'd like to adapt my component to your ListView component so I can access it in this way, but I wasn't successful so far I'm afraid!