What unit testing frameworks are used for Rails?
I am reading the book (Pragmatic Programmers Agile Dev. with Rails) which shows how to do unit tests in Rails.
The book showed me the default rails testing suite (a subclass of Test::Unit
). Is this the main testing framework that is used in the Rails community? I use RSpec when doing regular ruby, and I would like to be able to use it in Rails too (if it's not too much of a hassle)?
There are many tools for testing rails and other webapps from many different aspects. But if you are new to testing I highly recommend you start with learning Rails' own testing framework before start using other tools.
Learning, and later mastering, one testing framework makes it easier in the future to understand pros/cons with other framework and make them work in unison.
You could start with testing the following things:
I have seen many failed testing efforts, but I never saw them fail because they choose the wrong tool/framework. They fail because they don't know how to master the tools they use, and learn enough about the basics about testing.
Read more about Rails testing here.
http://guides.rubyonrails.org/testing.html
Rspec is widely used in rails, and in conjunction with Cucumber, is one of the most widely used solutions today. note that rails 3 is using rspec 2, so look for rspec/rails. check out the pragprog.com book rspec and cucumber, a great resource written by the core teams. http://pragprog.com/titles/achbd/the-rspec-book
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With