[rspec-users] MVC testing vs. models & Webrat+RailsStory?

Josh Knowles joshknowles at gmail.com
Fri Jun 20 11:50:21 EDT 2008

On 6/19/08, Christopher Bailey <chris at cobaltedge.com> wrote:
>  Specifically, I'm wondering, or contemplating, if I do unit tests for
>  my models, and then I use WebRat plus RailsStory, do I even need to
>  then do functional testing of my controllers and views?  I can see
>  that I might want to do some particular view testing that ensured
>  certain elements were on a page or something, but in terms of actually
>  testing the workings of my app/site, it seems model unit tests
>  combined with RailsStory+Webrat will do a pretty darn thorough job.  I
>  would then consider going to Selenium to test some of the detailed
>  JavaScript as needed.
>  Thoughts?  What am I missing, or what are the downsides of such an approach?

Having spent the last 3 months working on a project which heavily
relied on Story Driven Development (currently 78 story files which
encompass 401 scenarios) one thing that I have found is that the build
has become quite slow.  We made a decision early on that we wouldn't
bother with view specs, as they felt redundant with our stories.
Looking back now I think that was a mistake.  If I were to do it over
I would leverage stories for the happy path, as well as to catch
expected error conditions, but I would also rely heavily on
Controller/View/Helper specs to test all of the branches and abnormal
use cases.

Basically I think that you should test as much stuff at the unit level
as possible, and leverage the integration tools where appropriate, but
don't overuse without expecting some decrease in performance.

Josh Knowles
phone: 509-979-1593
email:  joshknowles at gmail.com
web:    http://joshknowles.com

More information about the rspec-users mailing list