Marnen Laibow-Koser wrote:

>> - 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?

RSpec is for BDD, like FIT or FITnesse. It's for communicating with your 
business-side analysts about all your features. For raw development, it adds 
clutter to the syntax without adding much new innovation to the test flow.

And, yes, all the developers are eating it up like popcorn...

>> 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...

Right - leave it running and save your files over and over again. Each time, 
practice successfully predicting what the tests will do.

And it bears repeating that TDD requires writing new tests and 
_watching_them_fail_, before adding the tested code. Don't just go write the 
test and then write the code. Don't write the code and then get around to 
testing what you got. Only write new code in response to failing tests.

And refactor refactor refactor. If your boss doesn't like it, keep refactoring 
until you get fired!

>> - 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. :)

I _enjoy_ their fragility (in their current incarnation). It forces you to 
review your tests.

If anything in TDD is fragile, or leads to too much debugging (p statements), 
revert and try again. TDD makes fragility an asset.

>> - 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.

Again, use the database to provide ready-made objects, and TDD your find() 
statements at the db. The decoupling will come, and "don't hit the db in 
testing" is all but a myth. (Darn you, Mike Feathers!)

>> 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.
> 
> :)

Yep. Tests should be easier and easier to write, until you feel guilty and 
think 
they must not be doing anything for you.

-- 
   Phlip


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to