Fernando Perez wrote: > My advise: > > - Don't bother with RSpec's hype. I tried it and got me pissed off so > many times.
I completely disagree. RSpec works very well, and its syntax is generally more natural (at least to me) than Test::Unit. In what way does RSpec not work for you? > Don't care about autospec, it will distract you more than it > will help. Again, I disagree 100%. I find it extremely helpful to get immediate feedback when my tests break. If you find autospec "distracting", I wonder if you're really paying enough attention to your tests... [...] > - Use mocha to mock and/or stub your method calls so that you test > objects as isolated as possible from other objects. Yes. Mock everything that isn't what you're trying to test. (You only need Mocha if you're not using RSpec, which has its own mocking framework; however, it too will work with Mocha if you prefer it.) > > - rcov can come in handy to know what parts of your app are not yet > tested. Be careful: 100% test coverage, doesn't mean your app is still > correctly tested. Heck yes. > > - Don't ever use fixtures at all! Run away from any person who tells you > they are fine, even if he is famous and rich. Agreed, with the possible caveat that Phlip seems to like them, and I trust everything *else* he says about testing. :) > > - Write your tests (even unit tests) so that they hit DB as least as > possible. Yes, but don't go through silly contortions to religiously avoid the DB altogether if it's more trouble than it's worth. RSpec's mock_model and stub_model are lovely here. > When tests have to hit DB such as :include or :joins, then > setup sqlite in-memory for faster testing. I don't see how this would work if you're using the DB in any reasonably sophisticated way, given that SQLite tends not to support such things. [...] > > - use a notifier plugin on your production server to catch any > additional edge case you haven't thought of (I use getexceptional), and > write tests to prevent against them in the future Good advice. > > > Writing tests is easy when you know how to write them and which tools to > use. > > Remember to have fun. If you are not having fun (even writing tests) > then something is wrong. :) Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

