Mock Objects

Frank Shearar frank.shearar at angband.za.org
Fri Jun 23 09:12:48 UTC 2006


"Chad Nantais" <chad at clearwaterassociates.ca> wrote:

> Hi.
>
> Could someone please direct me to a Squeak project (or some
> documentation) that uses mock objects in its tests, specifically
> dealing with testing network code like a web service.  I'm looking for
> a way to speed up some unit tests that hit a remote service.

It's by no means fully functional, but you might want to look at
MockSocketStream. That SHOULD be in Squeak-3.8 and up, seeing as I wrote it
in 2004.

Having a mock network layer not only lets you speed up tests, it also allows
you to disregard all the lovely things that can go wrong in the network. You
can run your tests knowing that you're not going to get red everywhere
because your colleague tripped over your fly lead, or is fiddling with a
patch panel in the next room. And, of course, a mock network layer lets you
INJECT errors :)

I do intend adding to the MockSocketStream at some stage, but my plate's too
full for the next several months.

frank




More information about the Squeak-dev mailing list