Re: [ruby-81] Pros + cons of various testing frameworks...

From: user 3.
Sent on: Saturday, August 22, 2009 5:11 PM
Jon,

For improving test coverage on a "legacy" app, ie. an app that was not developed TDD, I advise the following. I also keep hearing references to a book about working w/ legacy code but I haven't read it.

* For any bug discovered, add new tests that reproduce the bug, then fix it.
* For any new features, use TDD
* Same for modifying existing features.
* I don't believe there is great value in a wholesale test-writing effort after the fact. Tests written after the code is already existing are *much* less valuable than TDD tests, because you're never sure they test the right thing unless they have been developed TDD style. Also it's boring and time-consuming. It's better to spend the time becoming more fluent with the test framework.

Regarding tools, my preferences are:
* start w/ rspec tests. Focus on models first. Be sure all the biz logic code has been moved into the models and is not in controllers & views. Then focus on controller tests and important helpers. Rspec lets you nicely test controllers, helpers, libraries, views in isolation.
* cucumber and webrat are integration test frameworks and differ mostly in syntax but not in their role. They have the same role as the std integration tests. These are mostly useful to test the flow between multiple pages where more than one controller action is involved. Such as testing a password recovery feature.
* in general I spend most of my time and energy on model tests. This is where you get most bang for the buck.

I hope this helps.

By the way, I'm in Florida at the moment and just attended the first annual BizConf(.org) where I met among many others the fabled Jerry Weinberg. It was one of the most inspiring events I've been to in a long time.

-Wolf

-- Sent from my Palm Pr��


Jon Seidel wrote:

I'm in the process of upgrading my site and I want to also improve my testing.�� Right now I just have the basic, built-in Rails testing, but would like something better...
I saw Webrat at GoGaRuCo and was very impressed, and I've also heard a great deal about Cucumber and RSpec.
��
I'd appreciate comments about your experience/recommendations for a testing platform and the tradeoffs involved. FWIW, I'm doing all my development on Linux now
(Kubuntu Hardy/8.04) using Aptana Studio, subversion 1.6,��Rails 2.3.2, Active Scaffold, Capistrano 2.1.0, MySQL, and Passenger.
��
Thanks...jon
��

Jon Seidel, CMC��

EDP Consulting, Inc. / www.edpci.com / www.4mypasswords.com

Technology that means Business - Since 1979

3373 Guido Street

Oakland, CA 94602

phone: [masked]

fax: [masked]

��

The Certified Management Consultant (CMC) mark is awarded to consultants who meet the strict standards defined by the Institute of Management Consultants USA, including examination by their peers, client evaluations, and a written examination evidencing their understanding of the IMC USA's Code of Ethics.

Check out IMC USA for more information.

��




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Jon Seidel ([address removed]) from The East Bay Ruby Meetup Group.
To learn more about Jon Seidel, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup Support: [address removed]
632 Broadway, New York, NY 10012 USA

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy