Scott Hanselman

Avalon - CLI307: Automated UI Testing

October 29, 2003 Comment on this post [4] Posted in PDC | NUnit
Sponsored By

If you've ever written a complex Windows UI you may have thought about ways to automate testing of these frameworks.  It was easier in the old days, when every control had a Window Handle that you could get ahold of.  Then more and more controls were owner draw, painted or just magic.  Regardless, automated UI testing is a hassle.

In the last few years I've been all over NUnit.  Just as my dentist says “if you don't floss, don't bother brushing,“ I say, “if you don't Unit Test, don't bother coding.“  But the exception is usually UI.

I'm in a talk on Avalon's Automated UI Testing Framework.

The Avalon UI Testing Framework appears to expose the UI components as an Object Model, that they are calling “Control Patterns” that expose the behavior of the controls.

He's brought a Command Prompt up.  He brought up the Windows Device Manager and clicked on it.

The Command Prompt then displays:

[Tree View] [Has Children]
Patterns = I:Selection

then he types “children” and the Device Manager tree expands.

The Command Prompt says:

Patterns - I:Invoke, IHierarchyItem. I:ExpandCollapse. I:SelectionItem

he also checks out a Combo Box and it says

Patterns - I:ExpandCollapse.

This means that rather than exposing the controls directly to the UI Testing code, it exposes the BEHAVIOR.  So, in OOP terms, a ComboBox and a Tree Control both implement “ExpandCollapse.”  But it's not that simplistic.  It's really about behavior.

Think about this:  If you were using a 3rd party control, you'd have to use that library's proprietary APIs to manipulate it.  With the Windows UI Automation framework the publisher of that control will expose behaviors.  If it's a funky Outlook Bar, perhaps it exposes ExpandCollapse also. 

You can query these controls for their behavior, ala “Reflection.”  Makes me think of how cool it was 8 or so years ago when I saw Spy++.  Except rather than presenting a physical “tree” this framework presents a logical, practical tree.  (The guy in front of me works for Infragistics.  I can only guess what awesome UI Controls they are going to build.  They kick much tush.)

The namespaces (alpha) are MSAvalong.Windows.Automation.  This framework supports ALL LEGACY controls, including VB, WinForms, Win32, etc.  There is also a complete Security Model so your testing software can't be used by the powers of darkness like .VBS files.

Along with this Logical Tree, you get all Properties, Events, Control Patterns and all Input (Mouse, Pen, Keyboard, etc).  Plus, it supports filtering, so you don't get messages shouting at you.

Rather than using the Class Name (and there are thousands) to identify a control and switch on how to test it, you think about the essense of the control and it's behavior.  For example, if you're testing software doesn't know what a control is, it asks it and hears “Oh, you're clickable? And expandable?” and you write tests appropriately.

(Awesome, he was just going to start a demo, but the screen saver locked his machine.  He can't remember the password...right now we're looking at a Longhorn security screen as he tries to log in...ouch...I know what this feels like.  He's going to reboot. Oy.)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

PDC - Day 3: Hump Day Begins? Not quite, it's 2am

October 29, 2003 Comment on this post [1] Posted in PDC
Sponsored By

Looks like they are getting the .NET Developer's Journal Radio Interviews up here.  My interview is in there, but the link is broken and the topic they list isn't at all what we talked about. :) Other than those small issues, you can certainly listen and enjoy.

On another note, had a lovely evening, here's a pic of me and Scoble.  You can tell by our positioning in the photo that we are very close friends.

Here's Chris Anderson, who I don't IM enough.  He really kicked bootay in the Keynote.  Kudos.

And here's the boys themselves, Early & Adopter.  If you don't know these guys, get to know them now.  They are well known for their now-classic interview with the .NET Framework 1.0 and .NET Framework 1.1Also, check out a sample chapter of their Whidbey book at the MSPress Booth.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

PDC Day 2.5 - The Rotating Restaurant

October 29, 2003 Comment on this post [0] Posted in PDC
Sponsored By

Chillin' at the top of the Westin with Shawn Wildermuth (ADO Guy), Michele Bustamante, Christian Weyer, Clemens Vasters, and Cathie Gero.  Best pretzels in L.A. 
Scott Hanselman - Corillian Corp
scott@corillian.com
--------------------------
Sent from my BlackBerry Wireless Handheld

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Tablet PC scoop

October 29, 2003 Comment on this post [2] Posted in
Sponsored By

I'm at an undisclosed location with the Avalon Team and given the light of some new information, I'm (and you) should wait a month before buying a TabletPC.  The new Toshiba will have 128megs of Video RAM.  I'd like to have my TabletPC support Longhorn, and this was just the information I needed.
Scott Hanselman - Corillian Corp
scott@corillian.com
--------------------------
Sent from my BlackBerry Wireless Handheld

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

PDC - Day 2 - WSV303 - Indigo, Using XSD, CLR Types and Serialization in Web Services

October 29, 2003 Comment on this post [4] Posted in Longhorn | PDC | ASP.NET | XmlSerializer | Tools
Sponsored By

I'm here sitting with Rory in the Xml Serialization talk being given by the legendary Doug Purdy.  Doug's quite a good speaker and very funny.

Lengendary? Why?  Well, not only is he responsible for the goodness that is the XmlSerializer, he's also responsible (or he knows the guy who is) for this undocumented switch:

      <ADD value="1" name="XmlSerialization.Compilation" />

If you add this to a .config file (for your AppDomain) you'll get some temporary files in c:\documents and settings\local settings\\temp.  Try it.  Run some serialization code and checkout the .CS file(s) that are created.  Very damn useful.  This works today with .NET.

But I'm here to hear about new versions of stuff.  Here's some new things about XmlSerialization in the Whidbey version of .NET.

  • There's a tool called SGEN that will “NGEN” your serialization code. That way you don't need to take the initial hit when the Serialization Assembly is emited.  You can basically ship it with the code.
  • Adding support for Generics to the Serializer, both open generics and instatiated generics
  • Support for Extensibility around Schema Importing
  • SqlType support
  • The BinaryFormatter is Version Tolerant
  • Here's some new Attributes:
    • [OptionalSerializable] - Does just what you'd think.  Makes a field optional, and consequently helps you deal with Version changes between Object Heirarchies

Here's what's going on with XmlSerialization in Indigo (after Whidbey, in Longhorn):

  • The Serializer is now in the Core
  • Architecture of the CLR, not just “tacked on“
  • A Tale of Two Type Systems
    • Act One: Whidbey
      • Mapping XSD into the CLR is very challenging, including mapping some of the concepts that exist in XSD that just don't in the CLR
      • Mapping from the CLR to XSD is fairly straightforward
      • CLR to CLR is really easy
    • Act Two: Indigo
      • Big Conclusion - Serialization is different than Xml Programming.  Developers don't think about the format on the wire.  They want the CLR to fix it for them.
      • New stack: XmlFormatteer consiting of Serialization Engine -> Extensibility -> Xml Processing - Representations
      • XmlBinaryReader and XmlBinaryWriter being introduced
      • Allow the developer to express the data contract for a given type Explicitly
      • [DataMember] lets you markup any member and include it into the Data Contract.  It doesn't care about accessiblity.  That means you can mark something private or internal and if it's marked with [DataMember] then it gets serialized.
      • Cool...you can have two totally “different“ CLR types, perhaps one has a private something with a property accessor and another version has the same “semantic“ member but it's public.  You can mark them up with DataMember to make the contract with the serializer the same so the objects will serialize the same.
      • WHY IS THIS IMPORTANT: You can serialize one CLR object from one Assembly and deserialize it into another totally different implemenation (a totally different CLR type).  As long as we both agree on the contract, we can use the same underlying data representation.  Yum.
  • Existing Types continue to work, but you get loose coupling and version resiliance

Doug said he woke up this morning hoping the sky would be Indigo.  It wasn't.  But one day...

P.S. I forgot to mention that Christian Weyer can lift Rory with ease.  If he were Austrian, he could be a governor.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.