[Newbies] Unit testing
Sean P. DeNigris
sean at clipperadams.com
Sun Apr 18 05:33:42 UTC 2010
After doing a lot of snooping around my image, I was surprised by the unit
tests I saw (this is not a criticism, but me wanting to understand and
contribute to the Squeak philosophy). Coming from C++, and then Ruby, the
conversation is (for unit tests) to mock/stub out absolutely everything that
the object-under-test interacts with; of course augmented by
integration/functional/acceptance tests to verify the actual interactions.
Dependency injection is in full force (which I always find ugly and
complicated, but does make testing very easy).
Yet in Squeak's core, I found things like KernelTests-Chronology
StopwatchTest>>testActive, which sets a delay and - gasp - actually waits
for the time to tick by. I would've always created a clock double to
pretend that time had passed (even though, for the few seconds that passed
in these particular tests, probably not a big deal; but when you add similar
tests up all over the image?).
Also, in Ruby, there is a huge push (e.g. rspec community) to write tests
that a prospective library user could come along and see clear examples of
how to use the classes; not to mention the BDD craze (which I've seen a few
libraries for, but don't seem to be widely used) that helps refocus design
based on behavior.
Anyway, I'm presenting this because I am blown away by the Dynabook/Open
Personal Computing vision. I'm clear that all the objects in my world want
to live in a Squeak image.
So it's important to me to:
* spur conversation and growth
* make sure code that I write fits with the spirit of the community
View this message in context: http://n4.nabble.com/Unit-testing-tp2014654p2014654.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
More information about the Beginners