A place for spare thoughts

01/05/2014

Creating custom UIA patterns in managed code

Filed under: automation, wpf — Ivan Danilov @ 15:32

I’ve finished first working version of the library that makes subject easily feasible. Here is the implementation along with some documentation: https://github.com/ivan-danilov/uia-custom-pattern-managed#creating-custom-uia-patterns-and-properties-with-c

My target is to make it work smoothly with WPF, but for WinForms or with bare UIA it works as well.

Advertisements

5 Comments »

  1. Hi Ivan, first thank you for this work, it’s another method than what i found before, i’m new to UI Automation and i would like to make some wpf custom control accessible by coded ui builder, the example app with AdvTextControl is working fine but when i create a new coded ui test project and try to spy the control whith coded ui builder i don’t get the custom properties. I think i’m missing something i didn’t understand, with the other method using the extension i used to add the extension dll as a reference to the test project, but here i don’t really see how it could be done. So it would be great if you can add a simple coded ui test project using the custom control to access its properties with an assert by example or anything you would like as the coded ui builder cross tool can list the custom properties. I would be really greatful, thank you Ivan.

    Comment by Amine — 06/12/2016 @ 13:17

    • I guess Coded UI has hardcoded list of UIA patterns it understands and does not allow to extend it. In any case I’m not an expert in Coded UI, so it is better to ask someone from Microsoft.

      Comment by Ivan Danilov — 06/12/2016 @ 14:03

      • Thank you for your quick reply, for coded ui, I created an extension but it consist on returning a string with all the custom properties, I have already requested the support of microsoft, and it is this last method as well as the one that You explained to which they oriented me but without a lot of details.
        Do you use the white framework to do UI automation? Can you add on your github an example with it(white) on the AdvTextControl, any UI automation just to see how to take advantage of the custom pattern in practice.
        Thank you

        Comment by Amine — 06/12/2016 @ 15:15

    • (Looks WordPress does not allow to leave third level of replies, weird one…)
      Yes, we use White, but it is somewhat painful in some moments, so we are isolating it from the rest of our automation. Probably will switch to FlaUI at some point. For custom patterns I wrote some extension methods that make its usage almost as convenient as through White. Maybe at some point I (or someone else) will make contribution to FlaUI to support custom patterns out of the box. For now I’ve made changes to VisualUIVerify so that it can inspect custom properties easily. It is a repo in TestStack org on github if you’re interested.

      Comment by Ivan Danilov — 06/12/2016 @ 15:39

      • (maybe they find this not very pretty…)
        I will try the modified VisualUIVerify version .
        The ultimate goal is not only to inspect custom properties, but to be able to create a UI Automation test case based on these prorpieties for QA.
        It seems that there is no solution completed at the moment.
        Thanks again for your replies Ivan.

        Comment by Amine — 06/12/2016 @ 16:14


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: