Best Practices for Rails Web Application Testing?


#1

Hi all,

I am going to paint a probably familiar scene. My first rails project
was a supposedly simple web application, which has now been under
development for 2 years, has expanded to about 12 models, and is a
full blown web application.

As a newbie to ruby and rails, I paid exactly zero attention to
testing at the beginning, and as a result, I probably have over a
thousand lines of code now, and zero lines of test code. I realize
the error of my ways, especially now that I am tracking down a very
elusive bug, and I would even like to move to a TDD/BDD model with my
idea guy.

The problem that I am facing is twofold: first I’m not a software
developer in real life, so I don’t have much exposure to the “testing
world” in the first place. I had to look up the difference between a
unit test, a functional test, and an integration test. But beyond
even that, I am having trouble understanding the “state of the union”
as far as testing rails web-apps is concerned. There seem to be so
many different products, and I don’t really understand which ones test
what, and how much testing is required. Where do they overlap?

I’m aware of the built-in testing functionality, but I’m reading that
people are using that less and less. Then I read about rspec and
cucumber. Cool stuff, but does it replace testing with the built-in
Test::Unit?

I read the series of posts here:
http://blog.rubyyot.com/2009/01/chores-a-test-driven-website/
and what I came away with was that something like cucumber is good for
functional testing, but unit testing should still be done with
Test::Unit. And that it is important to keep the two roughly in
sync… as cucumber drives your development of new units, be sure to
test them with the built-in testing as you go.

Comments or thoughts would be greatly appreciated. Am I on the right
track here?