On 8/31/07, buendia [email protected] wrote:
I’m going to start my first real rails project, but I still can’t find
the answer of this questions:
What approach is better - TDD or BDD?
BDD is evolving to where this is a false question. BDD has become an
agile process that starts with conversations between project owners,
business analysts, testers and developers and continues all the way
down to how you, as a developer, write individual lines of code. That
last part is TDD whether you’re doing BDD or not.
Which of these two - Test/Unit or RSpec, makes tests easier to write,
read and maintaince?
This seems like the real question: which tools better serve your goals.
Or they just give me different options to reach the same goal?
Well - it depends on your goals. There is a lot of overlap between the
goals espoused by test/unit and rspec. If your goals all lie within
this overlap, then they are different options for the same goals.
What will be your advice?
Disclaimer: I am the lead developer/maintainer of RSpec.
You’re not going to find a definitive answer to this question. Nor
should you. I doubt that there is any measured, empirical evidence
that proves without a doubt that any single approach is the right
approach. What you will find are individual people’s answers based on
their personal experiences. Some will vehemently advocate one or the
other, but you should be wary of such vehemence (especially if it
comes from me!).
Since this is your first real Rails project, then community support is
going to be a big issue for you. If I were in your shoes, I’d peruse
this list and the rspec-users list and see what sorts of conversations
go on vis a vis testing. Naturally, the RSpec list is all about
testing (even though BDD is not about testing ), so there will be a
larger percentage of the conversations about it, but you should look
for the conversations about testing in this list as well.
Of course, I prefer and use RSpec myself because, in my experience, it
better supports the things you are asking about: write-abilty,
readability, and maintenance. I’ve also heard from a couple of
well-respected TDD experts that RSpec helps them do TDD the way they
want to be able to do it. I think that’s all I’ll say about this for
now, because you’ll likely be better served be hearing about
experiences of people other than me.
I look forward to other’s responses to this.