"Phlip" <phlip2005@...> writes:
> Anthony Williams wrote:
>> I've written a
>> bunch of helper functions for simulating various user actions on a dialog
>> by
>> sending the appropriate sequence of messages. You can then simulate e.g. a
>> selection of an item from a combo drop-down, or a double-click on a list
>> item,
>> or a user entering data in a text box and assert on the consequences.
>
> I suspect all such functions can run without displaying the window.
Absolutely. One of my helper functions is called windowWouldBeVisible() --- I
use it to verify that controls are correctly hidden or shown as appropriate,
even when the dialog is not actually displayed.
I always create the window, but without the WS_VISIBLE flag, so it's never
actually shown.
> And they certainly don't run like capture-playback tests...
No. Everything is based on control ID rather than mouse movements. The
simulation functions verify that the control is present, and of the
appropriate type, and then fire the appropriate sequence of messages as-if the
user had done a particular action. Sometimes I don't bother with the full set
of messages, if I know that I only need a couple in order to get the effect I
require, but I can always extend the simulation functions when more accurate
representation is required.
Anthony
--
Anthony Williams
Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL