# Test/Unit or RSpec

**URL:** <https://www.ruby-forum.com/t/test-unit-or-rspec/113455>\
**Category:** Rails\
**Created:** [August 31, 2007, 9:50am UTC](https://www.ruby-forum.com/t/test-unit-or-rspec/113455 "2007-08-31T09:50:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![buendia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@buendia](https://www.ruby-forum.com/u/buendia)\
**Post date:** [August 31, 2007, 9:50am UTC](https://www.ruby-forum.com/t/test-unit-or-rspec/113455/1 "2007-08-31T09:50:46Z")

</div>

Hi,  
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?  
Which of these two - Test/Unit or RSpec, makes tests easier to write,  
read and maintaince?  
Or they just give me different options to reach the same goal?

What will be your advice?

---

<div class="post-metadata">

**Author:** ![buendia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@buendia](https://www.ruby-forum.com/u/buendia)\
**Post date:** [August 31, 2007, 11:33am UTC](https://www.ruby-forum.com/t/test-unit-or-rspec/113455/2 "2007-08-31T11:33:57Z")

</div>

On 8/31/07, buendia [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,  
> 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.

Good luck!

Cheers,  
David

---

<div class="post-metadata">

**Author:** ![buendia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@buendia](https://www.ruby-forum.com/u/buendia)\
**Post date:** [August 31, 2007, 12:30pm UTC](https://www.ruby-forum.com/t/test-unit-or-rspec/113455/3 "2007-08-31T12:30:19Z")

</div>

Thanks a lot for this answer, David!

---

<div class="post-metadata">

**Author:** ![buendia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@buendia](https://www.ruby-forum.com/u/buendia)\
**Post date:** [August 31, 2007, 2:42pm UTC](https://www.ruby-forum.com/t/test-unit-or-rspec/113455/4 "2007-08-31T14:42:38Z")

</div>

buendia 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?  
> Which of these two - Test/Unit or RSpec, makes tests easier to write,  
> read and maintaince?  
> Or they just give me different options to reach the same goal?

All test cases start by checking syntax, and all testers should reach  
for  
the goal of testing semantics.

BDD is a step closer to the semantic side, by expressing requirements as  
natural language statements. With.delimiters.between:the\_words.

–  
Phlip  
[http://www.oreilly.com/catalog/9780596510657/](http://www.oreilly.com/catalog/9780596510657/)  
“Test Driven Ajax (on Rails)”  
assert\_xpath, assert\_javascript, & assert\_ajax
