About/Contact

Steve Trefethen

Steve Trefethen is a Director of Engineering at Reply. Contact me

View my LinkedIn profile


Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?
$720 in referrals so far!


Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

Disclaimer

The posts on this weblog are provided AS IS with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.



Automating popup windows and dialogs

October 26 2006 7:38AM
I've been discussing Zombie, our internal testing framework and last time I talked about generating and using models which are classes used to drive a UI. Previously, I gave an example of a simple model that had a constructor called Connect. One reader, Eric Fortier commented asking how is the Connect constructor used? That's a really good question.

The Connect constructor is a model specific override that looks like this:
constructor TMyFormModel.Connect;
begin
  inherited ConnectTo('TMyForm', nil);
  Init;
  Bind;
end;
Of course, the next question is what does ConnectTo do? Well, as you can see it takes the classname of the form that's modeled, the second parameter is for the caption but typically it's not required so for  generated models it's always nil. The ConnectTo constructor uses a special "wait" function which is similar to the Windows FindWindow API call but has the ability to continue searching for a window for a period of time before giving up or timing out. In fact, our framework has a whole set of Wait routines that use our own FindWindow replacement built on top of EnumWindows and EnumChildWindows that supports things like partial matches on window captions and limiting the search to only windows which  are visible to name only two.

Once the window in question has been located the model initializes all of the GEMs, or individual component models necessary to drive the windows various UI elements then calls Bind. The Bind method hooks up the mechanism used for the model to inspect the Window at a deeper level for example the RTTI of the object that instantiated the window. Binding to a window is a complicated process and it's where the real power of the Zombie framework together with the VCL framework is  derived.
FacebookDel.icio.usDigg It!

Comments (2) -

10/26/2006 2:15:18 PM #

This may be a bad question, but is the Zombie framework source available out there someplace?

Michael

10/26/2006 2:59:35 PM #

Hi Michael,
  No, Zombie is not a shipping product. As I mentioned it's our internal testing tool.

-Steve

Steve Trefethen

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading