With the many testing framework that is available in the Ruby community namely: unittest, rspec, shoulda, and coulda, what would be the most appropriate testing framework to test my Rails model?
Do they basically have the same functionality, which is to unittest my model? When should I use which? What is the advantage of using one and not the other? Please help me decide.
Thank you very much for your insights.
I too would suggest starting with Test::Unit just to get a feel for it. Then take a look a look at some of the other frameworks and see what you like best. Shoulda is probably one of the easier ones to get started with coming from plain Test::Unit so it might be an ideal place to look next. On the other hand if you really like the syntax of RSpec you should definitely go with that.
Wars get waged over this topic, but the thing is it doesn't really matter what you use, as long as your doing some form of testing. Also there is nothing wrong with just sticking with Test::Unit if that suits you :)
Personally I'm a fan of the Shoulda + Factory Girl combo.
The differences mostly come down to personal taste. I recommend starting out with Test::Unit. There's plenty of documentation, and it's the default for Rails. If you want to add Shoulda to the mix later, you can do that very easily.
I also recommend using Factory Girl instead of fixtures. http://github.com/thoughtbot/factory_girl
Lots of people seem to love rspec. I had a hard time finding recent (and free) resources (tutorials) online on it. There are supposed to be good screencasts, but there's fee to access them. There are free screencasts, but they're very basic. There's a book coming out, but it's been probably a year since it's announced and due out this December. The beta pdf version is ~$50 if you want it early.
I suggest Test::Unit since you don't know it yet. Good to know since you might read someone else's code and need to know about it.