testing a code that runs in multiple processess and communicates via network

R

raven

Hello

How to set-up automated test-bench of repeatable tests?
In the tests: process #1 talks to process#2 via TCP/IP ; and we need to
somehow check whether the communication is successful. By "successful" i
mean: process#2 understood correctly (this would mean that, most likely,
code for both sending and receiving is working OK).

Where by "process" i mean operating system's process (task).

------
Longer version of my question ( in case the above version is unclear or
didn't provide enough details ) :

What are the "best practices" and tools when it comes to testing Java
application/library that has to run in multiple processes and communicate
via TCP/IP?

I seek a way for setting it in an automatic (preconfigured) way ( "click",
wait, see results; as it is the case with JUnit ). I suspect, that JUnit
does not support multi-process testing.

The most frequent functionality that i would like to test: process #1
informs process #2 via TCP/IP about something; process #2 receives the
information and stores its interpretation of the (parsed) message; now we
have to check whether "process #2 received and interpreted the message
correctly" i.e the interpretation by process #2 is correct and contents of
sent message are correct (i.e. the protocol is working correctly at both
ends).

Is it possible to setup such an automated "test bench" ( or "test
harness" ? ) in, say, JUnit?
----- ( end of longer version :) )


So far, after investigating for quite a long time, I've come across a
project named Pisces, which is described here :
http://www.onjava.com/pub/a/onjava/2005/07/13/pisces.html?page=3
Bu it seems far less popular and maintained and IDE-supported than, say,
JUnit ; so perhaps i am missing something more obvious/popular.
I've also found lots of EJB/HTTP/HTML/Mock testing tools but i doubt these
would be useful for the purpose that i've described.

Maybe some combination of Ant+JUnit+RMI+{maybe some
Eclipse/Netbeans/otherIde plugin} would be suitable?
I would be glad to see a more targeted "inspiration"/tutorial instead of
getting in the risk of "reinventing the wheel" as this testing scenario
seems not much unusual and I hope there are well-known solutions.

TIA

KarolRvn

PS
Is it ok to post the same question to http://forum.java.sun.com/ ?
 
M

Martin Gregorie

raven wrote:

....snippage...
The most frequent functionality that i would like to test: process #1
informs process #2 via TCP/IP about something; process #2 receives the
information and stores its interpretation of the (parsed) message; now we
have to check whether "process #2 received and interpreted the message
correctly" i.e the interpretation by process #2 is correct and contents of
sent message are correct (i.e. the protocol is working correctly at both
ends).
Not really answering your question, but....

From the sound of it, process 2 never acknowledges the messages it
receives. Unless process 1 is sending "fire and forget' datagrams and
has no interest in the fate of each datagram once its sent this is, IMO,
a really bad idea.

If you change your message handling protocol so that all messages are
acknowledged and make sure that the sending method(s) return success or
failure to the caller you'll end up with a much more robust message
transfer protocol as well as something that standard unit test methods
should be able to handle.

Correctly done, the overheads of message acknowledgment are minimal.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top