[Q] TDD example for client/server development?
Diego Fernandez
diegof79 at gmail.com
Mon Dec 4 02:58:35 UTC 2006
On 12/3/06, Sungjin Chun <chunsj at embian.com> wrote:
> So I have to write the behavior of the Socket object.
Well unless that you are writing an OS from scratch... you already
have a C API for sockets :)
The first step could be a test for the "binding" with the external
socket API (like loading the socket library, initialization, open,
close without errors).
If you are writing an OS using TDD --maybe SqueakNOS :)--, I think
that you could start with a "mock" network card that writes the
input/output to a Stream.
You could also start the initial test with an already implemented echo
server, so you don't have to write a server to test the client Socket.
For example:
EchoServerTestResource>>#setUp
osServerProcess := self startProcess: 'echoDaemon'.
EchoServerTestResource>>#tearDown
osServerProcess kill
I did that to test LDAP useractions for GemStone (useractions is the
term used in GemStone for C libraries that could be used from
Smalltalk).
So even if the server takes a few seconds to start (like OpenLDAP),
the #setUp method of the TestResource is called once until someone
sends the #reset message.
I think that if the server is small and could be easily installed by
each developer in the team, using a real server is more easy than
using a lot of mock objects.
Regards,
Diego
More information about the Squeak-dev
mailing list
|