in reply to
Test scripts for POE
Create a session that will test your class.
Use POE::Pipe::OneWay to portably create a one-way pipe.
Create an object of the class you want to test as a child of the test session. Give it the pipe's read-only filehandle.
The tester session writes one line of data to the pipe's write-only filehandle.
The class being tested will either respond with all expected events, or it won't (or it might crash or something else).
If the tester session receives all expected events, then the test has passed.
If the tester session hasn't received all expected events after a reasonable amount of time has passed, then the test has failed.
Was that the last line of test data?
Yes: Shut down the test.
No: Loop. Write the next line of test data to the pipe's write-only filehandle.
--
Rocco Caputo
-
http://poe.perl.org/
-
irc://irc.perl.org/poe
Comment on
Re: Test scripts for POE
Replies are listed 'Best First'.
Re^2: Test scripts for POE
by
vlad_s
(Novice)
on Jan 17, 2012 at 17:18 UTC
Thank you Rocco, this approach has worked. I was thinking about using pipes, but discarded the idea as the traditional pipe open function blocks. Thanks for writing POE::Pipe (and the rest of the POE as well, great job!)
[reply]
In Section
Seekers of Perl Wisdom