Cassius Rosenthal on 19 Sep 2007 17:27:38 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] rspec slides

Cliff Moon wrote:
Check out The core rails team goes through Q&A on that
site, and they're really great at explaining how to solve a lot of the
common problems and hangups people have with rails.

I would second your recommendation. By coincidence, the second post is "Testing the Right Stuff," ( ) which ends with:

Doing this for each and every test case is going to be quite time consuming and make your test cases extremely verbose. As with all things in software you’ll have to make a judgement call on this trade off and make a choice between coupling or verbosity.

Whatever approach you choose, just remember that misleading test ‘failures’ can slow down refactoring, and end up *reducing* your ability to respond to change. As satisfying as ‘100% coverage’ or 2:1 ratios may be, don’t blindly add assertions or mock objects just to satisfy a tool. Every line in your test cases should be there for a reason, and should be placed there with just as much care as you’d use for a line of application code.

This is the position that I advocate with RSpec, seconded by others like Jay Levitt's post referenced earlier: 100% coverage is never necessary, not always possible, and sometimes a burden.

To unsubscribe or change your settings, visit: