Joshua Muheim wrote:
> Does RoR have the possibility to use fixtures for web testing? Or am I
> completely on the wrong track, and CakePHP's doing everything the right
> way?

I'm not exactly sure what you mean by "web testing."

Here are the various levels of testing that Rails supports (Test::Unit):

1. Model (Unit tests)
2. Functional (Controller tests)
3. Integration (Controller + View tests)

RSpec (http://rspec.info/) is also popular and breaks things down a 
little differently:

1. Model specs
2. Controller specs
3. View specs
4. Helper specs

RSpec typically relies on a third party story runner for implementing, 
what Test::Unit calls "integration tests," called Cucumber 
(http://cukes.info/).

There are other frameworks that are popular as well (e.g. Shoulda).

FIXTURES ARE BAD!!!

Most of the Rails developers I know have completely stopped using 
fixtures to generate test data. Fixtures are difficult to deal with and 
cause more problems than they are worth.

Fortunately there are now a few really great fixture replacement 
frameworks. The ones I'm most familiar with are Factory Girl 
(http://github.com/thoughtbot/factory_girl_rails) and Machinist 
(http://github.com/notahat/machinist).

As far as using fixture data for what you are calling "web tests" I 
would actually advise against it in most cases. For most tests (or 
specs) above model/unit level it's best to use mocking. Using mocks 
instead of real model objects helps to isolate your tests from issues at 
the database level.

There are a number of really good mocking frameworks to choose from. 
RSpec has it own built-in mocking framework, but can also use a number 
of third-party mocking frameworks as well.

For more information on mocking see:
http://rspec.info/documentation/mocks/

Here's an overview of a number of options for testing in Rails:
http://upstre.am/tag/mocha/
-- 
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-t...@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