Subject: | restructure poe's tests |
POE has something like 600 tests, not counting thousand or so in
001_queue.t, and still this is not enough. The fact was driven home to
me today: "make test" performs beautifully, but "perl -MEvent
t/22_wheel_run.t" hangs. The combination of Event.pm and Wheel::Run is
not normally exercised.
The problem lies in the fact that POE::Kernel's implementation adatps to
the particular event loop that's loaded before it. So while
t/04_selects.t tests the select_* functions, those functions are
implemented differently if, say, IO::Poll is loaded. t/27_poll.t takes
advantage of this fact by simply loading IO::Poll and then executing
t/04_selects.t again.
Matt Cashner (sungo) proposed that POE's test be redone as proper unit
tests. That's an excellent idea, and it's more likely to occur now that
POE::Kernel's refactoring is nearly over. However, I think his proposal
still is not enough.
To ensure that tests are run in as many contexts as possible, I suggest
we restructure them so that many of them are run once per possible event
loop implementation. One way to organize this would be to divide the
tests into four groups:
1. Unit tests. These are tests of the very basic features that do not
change according to the loaded event loop. t/001_queue.t fits into this
category. They only need to be run once.
2. Loop-specific tests. These exercise features of a specific event
loop. They are also run only once.
3. Polymorphic tests. These tests are affected by the loaded event
loop, so they must be re-run for each available loop.
4. Meta tests. These are not really tests; rather, they invoke the
polymorphic tests once for each available event loop. Obvious corolary:
There is one meta test for each event loop.
The total number of tests would become Unit + Loop + (Polymorphic *
Meta). They would ensure that every event loop was capable of
supporting every POE subsystem, which is a lot more thorough than what
POE has now.
-- Rocco Caputo / troc@pobox.com / poe.perl.org / poe.sf.net