[SqNOS] New release: RTL8139 support, TCP/IP "working", native
improvements
Keith Hodges
keith_hodges at yahoo.co.uk
Thu Aug 3 23:29:26 UTC 2006
> Richie!
>
>> On the other side, for SqueakNOS I'm not writing no tests. I don't
>> really know how to write tests for the HardwareDevices, but the truth is
>> that I have not yet felt the magic of tests, so I'm not pushing it too
>> hard... mea culpa.
>
> That's really too bad! Stop working that way and start writing tests.
> You will love them!
>
> /Leandro
>
Dear Richie,
I think that it is fair enough to write some code without tests in order
to get things working, and I understand that it may be difficult to
write tests for hardware devices.
The way that we talk about testing does not really capture the true
nature and benefits of "test first" coding. There is an article by Dave
Astels about this, (and a podcast on the "Agile Toolkit" series) in
which he suggests changing the wording that we use to talk about tests,
and then it makes a lot more sense and can begin to drive and support
the way we develop. This approach has been called Behaviour Driven
Development, and I think it may be worth a look for you.
Dave talks about specifications. First defining the working context.
context( initial state, hardware is not present at all )
specification( auto discover should not find hardware )
{
expectation: do auto discover should raise NotFound
}
specification( attempt to send data should raise error )
{
expectation: send data should raise error
}
Dave has wrote a Smalltalk version of rSpec (ruby spec), called sSpec, a
month or two ago. I wrote spec.js for javascript. I believe that Dave
has it working and available in VisualWorks. It would be great if
someone just did the last bit of the port into squeak.
Another aspect of the specification frameworks is the extensive use of
Mock objects, and these beauties could be used to stand in for bits of
hardware in your tests. You can preload a generic mock object with the
expected behaviours and responses and pass it in instead of the real thing.
Like many will tell you tests rock, but thinking in terms of
specification of expected behaviour is a good way of thinking a problem
through. The use of a framework such as sSpec allows these thoughts to
be penned as an executable specification. Which is really cool... well
I thought so.
best regards
Keith
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html
More information about the Squeak-dev
mailing list
|