Testing Rails can be cumbersome but it's also very necessary.  You can 
hand-test all your code and do the greatest job possible but in the end, 
it won't be enough.  So, you should become familiar with a few testing 
platforms you can use with rails.

By default, whenever you create anything new with rails 2.3.2, test 
files are automatically created for you.  These tests, called Unit Tests 
are the very barebones basic test platform you can use with Rails.

** UNIT TESTS **

You can find information about Unit Tests here:

http://guides.rubyonrails.org/testing.html

** RSPEC **

But, Unit Tests may not be enough for you and you will find that there 
are some more popular methods of testing available.  One of the more 
common testing platforms is called Rspec.

http://wiki.github.com/dchelimsky/rspec

Screencast tutorial from Ryan
http://railscasts.com/episodes/71-testing-controllers-with-rspec

The tutorial screencast is a little old but it gives you an idea of how 
to test with rspec..

** AUTOSPEC **

A lot of people refer to autotest and autotest became Autospec. 
Autospec is very simple to use (it's also referred to as ZenTest, 
because of the gem name).  You can also use Autospec with Rspec to add a 
more complete testing platform for rails:

http://ph7spot.com/articles/getting_started_with_autotest

http://www.nateclark.com/articles/2008/09/17/_autotest_-is-now-_autospec_-how-to-set-up-autospec-for-rspec-and-rails-with-zentest

** SHOULDA **

Another new kid on the block is Shoulda.  It is actually a very 
interesting testing platform and it might not be as famous as RSpec but 
it's really easy to use and I'm starting to lean towards using shoulda 
over rspec, personally.  However, go with what platform you feel is best 
for "YOU"...

http://wiki.github.com/thoughtbot/shoulda/rails
http://wiki.rubyonrails.org/testing/shoulda
http://thoughtbot.com/projects/shoulda/tutorial?

Enjoy!



-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to