I'm at a loss as to how to set up rigorous
Test::More testing for an app I'm writing. The application consists of a server that runs a game played by multiple clients. There are always at least two clients involved and they alternately are waiting or acting based on messages from the server.
The issue is that I want to provide rigorous testing. In a perfect world I could just spawn a server, spawn the clients and run a scripted game, invoking tests as I go.
However I know that running tests from a child doesn't work. I looked at
Test::MultiFork, but frankly the documentation is sparse and what there is makes my brain hurt.
I have a current inkling of a solution. I'm using
Log::Log4Perl, I could setup a special logger that spits out state information, and have my test suite spawn the server and two scripted clients, let them interact in the background, and read the log output, running tests on expected vs actual behavior.
i.e.
SERVER: started
SERVER: accepting connections
CLIENT1: send connect
SERVER: accepted connection from client1
SERVER: send waiting for next connection to client1
CLIENT1: received waiting for next ocnnection
CLIENT1: entering wait state
CLIENT2: send connect
and so on. Then my test script can open a tail on the output and run tests like:
is(<INPUT>,"CLIENT1: entering wait state\n","client1 waiting");
Anyone have any comments or better ideas for how to test this beast?
-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
Edit by tye, change unclosed PRE tags to CODE
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.