From: Bradley K. E. <Bra...@Do...> - 2007-02-13 04:36:59
|
Mike Schroeder wrote: > Eric Wilhelm wrote: >> BTW, the TAPx project would love to have a wxPerl gui test harness >> example. There's something that could be used by many perl >> programmers, even programmers of other languages, and has a small, but >> non-trivial issue of IPC with running children in a fork. IMO, it >> would also be a great place to apply a Wx::TreeListCtrl widget. >> > Oh -- we've had another contractor (Brad Embree) working the past few > months on a test harness for wxPerl. At this point it assumes you will > be using the Wx::Data controls (see other email) which are > "test-aware". You can "record" a test, which gets saved (currently > using YAML I think??). You can then "replay" a test and the test > harness will compare actual vs expected. I'll see if Brad can write up > something more meaningful about this. > > Mike. I am actually in the process of finishing the test harness up, and integrating it back into our main trunk for some final testing. The basic idea is that we have our own Event class, that exports a register_event function. We register all events using this function, instead of using the Wx event "macros". For example: EVT_BUTTON( $self, $self->{create_account_button}, \&OnCreateAccount ); becomes: register_event( $self, 'EVT_BUTTON', 'create_account_button', \&OnCreateAccount ); The register_event function then "wraps" the event handler inside another sub that records the detail of the event (right now just to a text file) before calling the handler. We can turn "recording" on and off dynamically as the app runs. We can select a text file for "playback", and it will run through all the entries in the text file replaying the recorded actions. What I am finishing up now is a comparison of the data that is returned from our API during playback to what was received during the test run (it is this API data that is stored as YAML). If anyone is interested I can put together a more thorough write up, and perhaps provide a simple example app demonstrating recording/playback. Brad |