BDD and RSpec
As a personal bookmark: There’s a pretty reasonable thread over on the Ruby on Rails: Talk list about BDD and RSpec. Reasonable arguments on both side of the RSpec fence:
Then I attended a lecture by Aslak Hellesøy. I mean, with so many people
around raving about RSpec, I must be missing the point right? But I was
let down: Alsak demonstrated it to be a wrapper DSL around Test::Unit
for “people who find it hard to come to gripes with TDD”. So it’s a sort
of workaround? I was disappointed by that statement of his.
He says Test::Unit is tightly coupled to the actual code and that that’s
a bad thing. I say I like that coupling, because it keeps a sharp edge
on the test-before-you-write principle: if you’re mucking around code or
tests that worked before, you’ll find yourself pressed to advocate that
change and express it in an additional or revised test.
then:
BDD comes from TDD, which comes from XP, which includes Refactoring as
an integral part of the process. Refactoring is more expensive as your
tests are more tightly coupled to the code, so one goal of TDD is to
decouple the tests from the detail of the code (which is what changes
most often). One thing that aids in this decoupling is focusing on
behaviour instead of internal implementation. BDD champions this goal
by putting it front and center. RSpec supports this by trying to use
words like “describe” instead of “TestCase” and “should” instead of
“assert.”
and further RSpec support:
It’s a small tweak, to refocus TDD practitioners a slight bit. They
think it produces better specs/tests, not because it’s something that
couldn’t be done before, but because it’s now more obvious what you
should be doing.
Comments(0)
