[rspec-users] State Based vs. Behaviour Based Spec/Testing
aslak hellesoy
aslak.hellesoy at gmail.com
Sat Mar 24 09:11:12 EDT 2007
On 3/24/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
>
> I've notice that a project like Rubinius has both a spec & a test
> directory. Rspec has only a spec directory. Obviously I support
> BDD, but isn't there also a place for state based/verification
Anyone is free to write their code who they want. RSpec doesn't
mandate any particular style, it just encourages it.
> testing? I sometimes sense that I *do* want to practice Test Driven
> Development.
Ok. BDD is just a kind of TDD with a stronger focus on "tell don't
ask", mocking and intent.
> That is, I want some assurance that my production code
> will run as intended. But I also want some verification of a bug
> right after I have implemented it.
>
> How can one truly get away from state based testing to some degree?
Use mocking to drive out interaction between objects. Strive for a
"tell don't ask" design (look it up).
> Spec's often seem too "high level" to assure the "testing" of the code.
>
What do you mean?
> I know that Test::Unit code will always be brittle. What happens
> when the code is refactored? It is sure to break.
>
Huh? What is it about Test::Unit that makes it inherently brittle?
I have no idea what you are talking about here.
> Does this suggest that Test::Unit code should be written right after
> development is done, covering the internals of the project?
If you're doing TDD, no - you write tests before the code. If you're
"just using Test::Unit" you can write it when you want.
> Maybe
> BDD specs should be written first, using TDD with Test::Unit for
BDD *is* TDD, with some extra philosophical baggage. You write specs
before the code in both BDD and TDD.
> verification (as throw-away code)? Or do mock objects solve all of
> these problems?
>
What problems?
> The real question is, do you spec'ers think there is any place for a
> testing framework next to a spec'ing framework?
>
To solve what problem?
Aslak
> Best,
>
> Scott Taylor
>
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
More information about the rspec-users
mailing list