dreadpiratepeter has asked for the wisdom of the Perl Monks concerning the following question:
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.
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."
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.
and so on. Then my test script can open a tail on the output and run tests like: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
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Testing a Client-Server Application
by Steve_p (Priest) on May 05, 2004 at 16:20 UTC | |
Re: Testing a Client-Server Application
by paulbort (Hermit) on May 05, 2004 at 19:33 UTC | |
Re: Testing a Client-Server Application
by adrianh (Chancellor) on May 06, 2004 at 01:23 UTC | |
Re: Testing a Client-Server Application
by etcshadow (Priest) on May 06, 2004 at 04:34 UTC |
Back to
Seekers of Perl Wisdom