Is UI Automation really a good choice for the WPF application testing? [closed]
Asked Answered
B

0

6

When talking about automating the UI tests conversation always ends up with the UI Automation. Is it the only option?

I personally don't like it for one main reason - complexity. It is designed to be universal for all the types of applications. Such universality never comes for free. UIA introduces another layer of abstraction and a rather complicated API. The standard patterns are limited. Custom controls support requires a lot of coding. I wonder why anyone considers it to be a good option?

WPF has a brilliant and a very rich abstraction where the UI is a hierarchical tree of visual elements. These elements expose lots of methods, events and properties. The tree supports various ways of referring (relative source syntax for instance). And we loose all this might in UIA. For what? For the compatibility with the old-school apps and web? Well, realistically, who would need that? Jack of all trades is a master of none.

Tools like Snoop can inject themselves into a running application and get the full control over it. They can change the values of control properties and raise events. Won't that be enough? Nope. You'd want your test to interact with the UI as the user would do - using mouse and keyboard. But that's another problem which can be solved.

So I wonder, is there something I don't get about the joy of UIA?

Brande answered 13/3, 2013 at 12:23 Comment(2)
9 months later ended up with a DSL in F# for the tests scripting using UI Automation ;)Brande
Year and a half later rewrote it in C# with a dual API allowing to traverse either the UI Automation tree or the WPF Visual tree.Brande

© 2022 - 2024 — McMap. All rights reserved.