On Jan 9, 2008 6:09 AM, Kerry Buckley <[EMAIL PROTECTED]> wrote:
> On Jan 9, 2008 10:01 AM, Stefan Magnus Landrø <[EMAIL PROTECTED]> wrote:
> > I totally agree with you, David!

Then you agree with the majority of the TDD community.

> >
> > For quite a while I was testing all my methods (even had to declare them
> > protected/package scope in java!), but I realized that I was getting into a
> > lot of trouble. Now I've shifted to testing functionality in stead of
> > methods.
> >
> > Now, sometimes you might end up having small methods (typically a result of
> > refactoring) that are being used by several clients. In that case you should
> > start testing those methods, since they actually represent real business
> > logic.

Again, if they appear through refactoring, then they ARE tested
through the public methods. The only time I would test them directly
would be in the process of trying to locate the source of a bug, or if
I wanted to move the method to another class because it represented a
fundamentally different concept from the one represented by its
current class.

This is all TDD 101 stuff. Maybe we should have required reading on
this list ;) Here are a few suggestions:

http://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445/
http://www.amazon.com/Refactoring-Improving-Existing-Addison-Wesley-Technology/dp/0201485672
http://www.amazon.com/Test-Driven-Development-Practical-Guide-Coad/dp/0131016490/
http://www.amazon.com/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530/

These sorts of questions are explored in great detail in these books.

Cheers,
David


>
> I wonder whether that is a smell indicating that the functionality in
> those methods really belongs in its own class?
>
> Kerry
> --
> http://www.kerrybuckley.com/
>
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to