Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What testing frameworks are used for Rails? [closed]

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)?

like image 604
ab217 Avatar asked Sep 09 '10 00:09

ab217


2 Answers

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:

  • Unit Testing your Models
  • Functional Tests for Your Controllers
  • Learning about Fixtures and how to load test data

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

like image 104
Jonas Söderström Avatar answered Nov 11 '22 20:11

Jonas Söderström


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

like image 29
Jed Schneider Avatar answered Nov 11 '22 21:11

Jed Schneider