I’ll gloss over the “Why” of this…
Doing it (testing against WinForms applications) nonetheless reinforces the point that these are just implementations of Page Objects.
Frustrating point of the day: the lack of obvious correspondence between the properties exposed in the WinForms / C# editor for a given control, and what is exposed by the Coded UI Test Builder and SearchProperties collection in .Net / C#. I was going to do an example, and I shall regret not doing it as I shall forget the case.
Firstly, I had to change the “*” in the original to “mult”, as it appears that without escaping (I’m guessing) then “*” is not recognised or mis-translated. That aside, this is what WinForms says about it (I picked the app up from some msdn place, hence the misspelling):
So based on this, the Name is either btnMulitply or there is no name, or it’s the parent object. Note that Text is “mult”.
Now the code finds flaming “mult” as Name… which is quite frustrating. And as for the Edit control, well, there isn’t ANY way that I can see to uniquely identify that.
But at least the weekend yielded a good find in the form of the Page Object implementation on CodePlex. I still can’t work out if this is Microsoft work, given the Namespace.
Oh, there is this good thing as well, which identifies all the objects on your desktop.
This data driven attribute was a nice find as well: