1POE::Test::Sequence(3)User Contributed Perl DocumentationPOE::Test::Sequence(3)
2
3
4

NAME

6       POE::Test::Sequence - POE test helper to verify a sequence of events
7

SYNOPSIS

9         Sorry, there isn't a synopsis at this time.
10
11         However, see t/90_regression/whjackson-followtail.t in POE's test
12         suite for a full example.
13

DESCRIPTION

15       POE::Test::Sequence is a test helper that abstracts a lot of the
16       tedious trickery needed to verify the relative ordering of events.
17
18       With this module, one can test the sequence of events without
19       necessarily relying on specific times elapsing between them.
20
21   create_generic_session
22       The create_generic_session() method creates a POE::Session that routes
23       all vents through the POE::Test::Sequence object.  It returns the
24       POE::Session object, but the test program does not need to store it
25       anywhere.  In fact, it's recommended not to do that without
26       understanding the implications.
27
28       The implications can be found in the documentation for POE::Kernel and
29       POE::Session.
30
31       An example of create_generic_session() can be found in POE's
32       t/90_regression/leolo-alarm-adjust.t test program.
33
34   new
35       Create a new sequence object.  Takes named parameter pairs, currently
36       just "sequence", which references an array of steps.  Each step is an
37       array reference containing the expected event, a required parameter to
38       that event, and a code reference for the optional next step to take
39       after testing for that event.
40
41         my $sequence = POE::Test::Sequence->new(
42           sequence => [
43           [ got_idle_event => 0, sub { append_to_log("text") } ],
44           ...,
45         ]
46         );
47
48       next() uses the first two step elements to verify that steps are
49       occurring in the order in which they should.  The third element is
50       returned by next() and is suitable for use as a goto() target.  See the
51       next() method for more details.
52
53   next
54       The next() method requires an event name and a scalar parameter.  These
55       are compared to the first two elements of the next sequence step to
56       make sure events are happening in the order in which they should.
57
58         sub handle_start_event {
59           goto $sequence->next("got_start_event", 0);
60         }
61
62   test_count
63       test_count() returns the number of test steps in the sequence object.
64       It's intended to be used for test planning.
65
66         use Test::More;
67         my $sequence = POE::Test::Sequence->new( ... );
68         plan tests => $sequence->test_count();
69

BUGS

71       create_generic_session() is hard-coded to pass only the event name and
72       the numeric value 0 to next().  This is fine for only the most generic
73       sequences.
74

AUTHORS & LICENSING

76       Please see POE for more information about authors, contributors, and
77       POE's licensing.
78
79
80
81perl v5.28.1                      2014-07-12            POE::Test::Sequence(3)
Impressum