Hi,
I've been using Microsoft UI Automation library for automated regression testing.
I've had some success, I can search for a particular row, scroll it into view, and read values from cells.
But I also want to do the following, be able to:
1) Select a row
2) Change visible columns (e.g. field chooser)
3) Enter a row (i.e. what happens when you double-click a row)
I see that UI Automation library has a GridPattern which looks useful, but UltraGrid doesn't seem to implement this - is that right, or is there anyway of getting it?
Thanks in advance.
Hi Greycon,
We implemented some UIA features in our controls in order to provide compatibility with the CodedUI framework. As a result, some of the patterns you would use in a UIA test are not implemented.
My recommendation is to use Infragistics TestAutomation for your automated testing. If you do not have the option of using Infragistics Test Automation, you can still use Microsoft UIA by scripting mouse clicks.
1) In order to select a row, you will need to get the AutomationElement for an UltraGrid Row. Then, you can call GetClickablePoint to get a point on the row. Since most of the row is covered by Cell elements, this method should return a point over the row selector, which does not have an AutomationElement.
2) To open the field chooser, you will need to calculate the appropriate point using the child elements of the grid's header. Since the field chooser button does not take up the full unobscured space of UltraGrid's header, you will not be able to count on GetClickablePoint to return a point that is on the button.
3) To do this, you can automate a double click within the AutomationElement for the cell you wish to activate.
Although this is possible to implement with UIA alone, I strongly recommend using Infragistics Test Automation for your regression tests. TA provides the framework you are looking for to easily automate tasks specific to Infragistics controls that cannot be automated through .NET's built-in automation framework.
Please let me know if you need more information.
Thanks! It's good to get confirmation that it would be necessary to use scripted mouse clicks and the GetClickablePoint() function.
I've investigated it briefly (using Visual UIA Verify) and although it looks as though it will be slightly convoluted, I think it will be doable.
One other thing I had wondered about, is that maybe it would be possible to implement the UIA GridPattern by implementing the System.Windows.Automation.Provider.IGridProvider interface. Do you have any experience about that?
Short answer, unfortunately is no. I pinged it with both the developer of the control and of our CodedUI support for the control, and they both agreed it is not feasible. It would be a mix of changing the underlyng framework of the control, to support it, then the implementing of the pattern would be measured in months in the initial estimate to properly implement it.
Sincerely.