[Q] TDD example for client/server development?

Frank Shearar frank.shearar at angband.za.org
Mon Dec 4 11:41:50 UTC 2006


I do all my TDD stuff (working on a SIP+RTP stack) the way Diego does.

The word "communication framework" is not very tightly defined: a SIP stack
is a pretty complicated communication framework for people to use, layered
on top of the OS's communication framework. Which communication framework do
you mean? A socket implementation? Or something that sits on top of
Socket/SocketStream type classes?

Either way, what worked really well for me was completely separating the
workings of the SIP protocol stack from the socket layer. In Squeak I guess
that would be something like MockSocketStream.

So I'd write a test that showed, say, that my client classes serialise a
message correctly to the socket. Then I'd write a test showing that my
server classes can parse a message correctly. Then I'd write a test showing
that what the client serialises is what the server can parse :). Then I'd
add the next series of tests.

Finally, I'd write tests removing the mocked-out sockets, and run actual
clients and servers on actual sockets and communicate via the underlying
network. That's really an end-to-end test (I forget what the literature
calls these tests), not a unit test.

But still, Diego's got it in a nutshell: test the client and server
separately, and then test them together. (And don't forget about
interoperability testing, if implementing a standard!)

frank

----- Original Message ----- 
From: "Sungjin Chun" <chunsj at embian.com>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Sunday, December 03, 2006 6:20 AM
Subject: Re: [Q] TDD example for client/server development?


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Thanks for your help, and...
>
> Diego Fernandez wrote:
> > I have done a lot of TDD for client/server (web services, http,
> > GemStone, LDAP) and my experience is this:
> >
> > - First of all focus in what behavior you are testing: are you testing
> > all the communication framework or are you testing the client (or
> > server) behavior? This is important because in most cases the
> > communication framework is already done, so you don't need to test it
> > again, ie testing (directly or indirectly) that the Socket object
> > works is non sense, unless you are writing the behavior for the Socket
> > object.
> >
>
> I want to create/test communication framework - actually I use this
> example for educating TDD for client/server development. Most guys in
> our class do think TDD is inappropriate for client/server development,
> even for simple echo server/client case. They say how can you make your
> step small enough to TDD when you cannot test communication.
>
> So I have to write the behavior of the Socket object.
>
> Thanks again.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFclCUQqspS1+XJHgRAoOzAJ4zdw9I5hZqpijUe86Z9c+5j1WwWwCeL0CX
> NdzByoMuUo8sJwJE6/qxSVg=
> =wGyE
> -----END PGP SIGNATURE-----
>
>




More information about the Squeak-dev mailing list